@@ -337,7 +337,7 @@ dictionary SubscribeOptions {
337
337
AbortSignal signal;
338
338
};
339
339
340
- callback Predicate = boolean (any value);
340
+ callback Predicate = boolean (any value, unsigned long long index );
341
341
callback Reducer = any (any accumulator, any currentValue);
342
342
callback Mapper = any (any element, unsigned long long index);
343
343
// 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
726
726
1. Let |observable| be a [=new=] {{Observable}} whose [=Observable/subscribe callback=] is an
727
727
algorithm that takes a {{Subscriber}} |subscriber| and does the following:
728
728
729
+ 1. Let |idx| be an {{unsigned long long}} , initially 0.
730
+
729
731
1. Let |sourceObserver| be a new [=internal observer=] , initialized as follows:
730
732
731
733
: [=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.
734
736
735
737
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a> ,
736
738
then run |subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these
737
739
steps.
738
740
741
+ 1. Set |idx| to |idx| + 1.
742
+
739
743
1. If |matches| is true, then run |subscriber|'s {{Subscriber/next()}} method, given
740
744
|value|.
741
745
0 commit comments