Skip to content

Commit

Permalink
Remove accidental re-addition of IDL
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh authored Jun 11, 2024
1 parent c5a259a commit 7413cad
Showing 1 changed file with 0 additions and 88 deletions.
88 changes: 0 additions & 88 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,94 +295,6 @@ the platform, since it's an easy drop-in wherever you're handling events today.
The proposed API shape can be found in
https://wicg.github.io/observable/#core-infrastructure.

```js
dictionary ObservableEventListenerOptions {
boolean capture = false;
boolean passive;
};

partial interface EventTarget {
Observable on(DOMString type, optional ObservableEventListenerOptions options);
};

// `SubscribeCallback` is where the Observable "creator's" code lives. It's
// called when `subscribe()` is called, to set up a new subscription.
callback SubscribeCallback = undefined (Subscriber subscriber);
callback ObserverCallback = undefined (any value);

dictionary Observer {
ObserverCallback next;
VoidFunction complete;
ObserverCallback error;
};

dictionary SubscribeOptions {
AbortSignal signal;
};

dictionary PromiseOptions {
AbortSignal signal;
};

[Exposed=*]
interface Subscriber {
undefined next(any result);
undefined complete();
undefined error(any error);
undefined addTeardown(VoidFunction teardown);

// True after the Subscriber is created, up until either
// `complete()`/`error()` are invoked, or the subscriber unsubscribes. Inside
// `complete()`/`error()`, this attribute is true.
readonly attribute boolean active;

readonly attribute AbortSignal signal;
};

callback Predicate = boolean (any value);
callback Reducer = any (any accumulator, any currentValue)
callback Mapper = any (any element, unsigned long long index)
// Differs from `Mapper` only in return type, since this callback is exclusively
// used to visit each element in a sequence, not transform it.
callback Visitor = undefined (any element, unsigned long long index)

[Exposed=*]
interface Observable {
constructor(SubscribeCallback callback);
undefined subscribe(optional Observer observer = {}, optional SubscribeOptions = {});

undefined finally(VoidFunction callback);

// Constructs a native Observable from `value` if it's any of the following:
// - Observable
// - AsyncIterable
// - Iterable
// - Promise
static Observable from(any value);

// Observable-returning operators. See "Operators" section below.
// `takeUntil()` can consume promises, iterables, async iterables, and other
// observables.
Observable takeUntil(any notifier);
Observable map(Mapper mapper);
Observable filter(Predicate predicate);
Observable take(unsigned long long);
Observable drop(unsigned long long);
Observable flatMap(Mapper mapper);
Observable catch(Mapper mapper);

Promise<sequence<any>> toArray(optional PromiseOptions options);
Promise<undefined> forEach(Visitor callback, optional PromiseOptions options);

// Promise-returning. See "Concerns" section below.
Promise<boolean> every(Predicate predicate, optional PromiseOptions options);
// Maybe? Promise<any> first(optional PromiseOptions options);
Promise<any> find(Predicate predicate, optional PromiseOptions options);
Promise<boolean> some(Predicate predicate, optional PromiseOptions options);
Promise<any> reduce(Reducer reducer, optional any initialValue, optional PromiseOptions options);
};
```

The creator of an Observable passes in a callback that gets invoked
synchronously whenever `subscribe()` is called. The `subscribe()` method can be
called _any number of times_, and the callback it invokes sets up a new
Expand Down

0 comments on commit 7413cad

Please sign in to comment.