summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/interfaces/observable.tentative.idl
blob: 3ccd486a202a981b6f88c8746fb3250ee4a29f16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[Exposed=*]
interface Subscriber {
  undefined next(any value);
  undefined error(any error);
  undefined complete();
  undefined addTeardown(VoidFunction teardown);
  readonly attribute boolean active;
  readonly attribute AbortSignal signal;
};


callback SubscribeCallback = undefined (Subscriber subscriber);
callback SubscriptionObserverCallback = undefined (any value);

dictionary SubscriptionObserver {
  SubscriptionObserverCallback next;
  SubscriptionObserverCallback error;
  VoidFunction complete;
};

typedef (SubscriptionObserverCallback or Observer) ObserverUnion;

dictionary SubscribeOptions {
  AbortSignal signal;
};

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