Skip to content

Commit b4b9d43

Browse files
authored
Fix predicate. Fix #140. (#141)
1 parent 5fac9fd commit b4b9d43

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

spec.bs

+7-3
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ dictionary SubscribeOptions {
337337
AbortSignal signal;
338338
};
339339

340-
callback Predicate = boolean (any value);
340+
callback Predicate = boolean (any value, unsigned long long index);
341341
callback Reducer = any (any accumulator, any currentValue);
342342
callback Mapper = any (any element, unsigned long long index);
343343
// Differs from Mapper only in return type, since this callback is exclusively
@@ -726,16 +726,20 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
726726
1. Let |observable| be a [=new=] {{Observable}} whose [=Observable/subscribe callback=] is an
727727
algorithm that takes a {{Subscriber}} |subscriber| and does the following:
728728

729+
1. Let |idx| be an {{unsigned long long}}, initially 0.
730+
729731
1. Let |sourceObserver| be a new [=internal observer=], initialized as follows:
730732

731733
: [=internal observer/next steps=]
732-
:: 1. [=Invoke=] |predicate| with the passed in |value|, and let |matches|
733-
be the returned value.
734+
:: 1. [=Invoke=] |predicate| with the passed in |value| and |idx|, and let |matches| be
735+
the returned value.
734736

735737
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>,
736738
then run |subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these
737739
steps.
738740

741+
1. Set |idx| to |idx| + 1.
742+
739743
1. If |matches| is true, then run |subscriber|'s {{Subscriber/next()}} method, given
740744
|value|.
741745

0 commit comments

Comments
 (0)