@@ -1239,19 +1239,160 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
1239
1239
<div algorithm>
1240
1240
The <dfn for=Observable method><code>every(|predicate|, |options|)</code></dfn> method steps are:
1241
1241
1242
- 1. <span class=XXX> TODO: Spec this and use |predicate| and |options|.</span>
1242
+ 1. Let |p| [=a new promise=] .
1243
+
1244
+ 1. Let |controller| be a [=new=] {{AbortController}} .
1245
+
1246
+ 1. Let |internal options| be a new {{SubscribeOptions}} whose {{SubscribeOptions/signal}} is the
1247
+ result of [=creating a dependent abort signal=] from the list
1248
+ «|controller|'s [=AbortController/signal=], |options|' s
1249
+ {{SubscribeOptions/signal}} if non-null», using {{AbortSignal}} , and the [=current realm=] .
1250
+
1251
+ 1. If |internal options|'s {{SubscribeOptions/signal}} is [=AbortSignal/aborted=] , then:
1252
+
1253
+ 1. [=Reject=] |p| with |internal options|'s {{SubscribeOptions/signal}}' s
1254
+ [=AbortSignal/abort reason=] .
1255
+
1256
+ 1. Return |p|.
1257
+
1258
+ 1. [=AbortSignal/add|Add the following abort algorithm=] to |internal options|'s
1259
+ {{SubscribeOptions/signal}} :
1260
+
1261
+ 1. [=Reject=] |p| with |internal options|'s {{SubscribeOptions/signal}}' s [=AbortSignal/abort
1262
+ reason=] .
1263
+
1264
+ 1. Let |idx| be an {{unsigned long long}} , initially 0.
1265
+
1266
+ 1. Let |observer| be a new [=internal observer=] , initialized as follows:
1267
+
1268
+ : [=internal observer/next steps=]
1269
+ :: 1. [=Invoke=] |predicate| with the passed in <var ignore> value</var> and |idx|, and let
1270
+ |passed| be the returned value.
1271
+
1272
+ If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a> , then
1273
+ [=reject=] |p| with |E|, and [=AbortController/signal abort=] |controller| with |E|.
1274
+
1275
+ 1. Set |idx| to |idx| + 1.
1276
+
1277
+ 1. If |passed| is false, then [=resolve=] |p| with false, and [=AbortController/signal
1278
+ abort=] |controller|.
1279
+
1280
+ : [=internal observer/error steps=]
1281
+ :: [=Reject=] |p| with the passed in <var ignore> error</var> .
1282
+
1283
+ : [=internal observer/complete steps=]
1284
+ :: [=Resolve=] |p| with true.
1285
+
1286
+ 1. <a for=Observable lt="subscribe to an Observable">Subscribe</a> to [=this=] given |observer|
1287
+ and |internal options|.
1288
+
1289
+ 1. Return |p|.
1243
1290
</div>
1244
1291
1245
1292
<div algorithm>
1246
1293
The <dfn for=Observable method><code>find(|predicate|, |options|)</code></dfn> method steps are:
1247
1294
1248
- 1. <span class=XXX> TODO: Spec this and use |predicate| and |options|.</span>
1295
+ 1. Let |p| [=a new promise=] .
1296
+
1297
+ 1. Let |controller| be a [=new=] {{AbortController}} .
1298
+
1299
+ 1. Let |internal options| be a new {{SubscribeOptions}} whose {{SubscribeOptions/signal}} is the
1300
+ result of [=creating a dependent abort signal=] from the list
1301
+ «|controller|'s [=AbortController/signal=], |options|' s
1302
+ {{SubscribeOptions/signal}} if non-null», using {{AbortSignal}} , and the [=current realm=] .
1303
+
1304
+ 1. If |internal options|'s {{SubscribeOptions/signal}} is [=AbortSignal/aborted=] , then:
1305
+
1306
+ 1. [=Reject=] |p| with |internal options|'s {{SubscribeOptions/signal}}' s
1307
+ [=AbortSignal/abort reason=] .
1308
+
1309
+ 1. Return |p|.
1310
+
1311
+ 1. [=AbortSignal/add|Add the following abort algorithm=] to |internal options|'s
1312
+ {{SubscribeOptions/signal}} :
1313
+
1314
+ 1. [=Reject=] |p| with |internal options|'s {{SubscribeOptions/signal}}' s [=AbortSignal/abort
1315
+ reason=] .
1316
+
1317
+ 1. Let |idx| be an {{unsigned long long}} , initially 0.
1318
+
1319
+ 1. Let |observer| be a new [=internal observer=] , initialized as follows:
1320
+
1321
+ : [=internal observer/next steps=]
1322
+ :: 1. [=Invoke=] |predicate| with the passed in |value| an |idx|, and let |passed| be the
1323
+ returned value.
1324
+
1325
+ If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a> , then
1326
+ [=reject=] |p| with |E|, and [=AbortController/signal abort=] |controller| with |E|.
1327
+
1328
+ 1. Set |idx| to |idx| + 1.
1329
+
1330
+ 1. If |passed| is true, then [=resolve=] |p| with |value|, and [=AbortController/signal
1331
+ abort=] |controller|.
1332
+
1333
+ : [=internal observer/error steps=]
1334
+ :: [=Reject=] |p| with the passed in <var ignore> error</var> .
1335
+
1336
+ : [=internal observer/complete steps=]
1337
+ :: [=Resolve=] |p| with {{undefined}} .
1338
+
1339
+ 1. <a for=Observable lt="subscribe to an Observable">Subscribe</a> to [=this=] given |observer|
1340
+ and |internal options|.
1341
+
1342
+ 1. Return |p|.
1249
1343
</div>
1250
1344
1251
1345
<div algorithm>
1252
1346
The <dfn for=Observable method><code>some(|predicate|, |options|)</code></dfn> method steps are:
1253
1347
1254
- 1. <span class=XXX> TODO: Spec this and use |predicate| and |options|.</span>
1348
+ 1. Let |p| [=a new promise=] .
1349
+
1350
+ 1. Let |controller| be a [=new=] {{AbortController}} .
1351
+
1352
+ 1. Let |internal options| be a new {{SubscribeOptions}} whose {{SubscribeOptions/signal}} is the
1353
+ result of [=creating a dependent abort signal=] from the list
1354
+ «|controller|'s [=AbortController/signal=], |options|' s
1355
+ {{SubscribeOptions/signal}} if non-null», using {{AbortSignal}} , and the [=current realm=] .
1356
+
1357
+ 1. If |internal options|'s {{SubscribeOptions/signal}} is [=AbortSignal/aborted=] , then:
1358
+
1359
+ 1. [=Reject=] |p| with |internal options|'s {{SubscribeOptions/signal}}' s
1360
+ [=AbortSignal/abort reason=] .
1361
+
1362
+ 1. Return |p|.
1363
+
1364
+ 1. [=AbortSignal/add|Add the following abort algorithm=] to |internal options|'s
1365
+ {{SubscribeOptions/signal}} :
1366
+
1367
+ 1. [=Reject=] |p| with |internal options|'s {{SubscribeOptions/signal}}' s [=AbortSignal/abort
1368
+ reason=] .
1369
+
1370
+ 1. Let |idx| be an {{unsigned long long}} , initially 0.
1371
+
1372
+ 1. Let |observer| be a new [=internal observer=] , initialized as follows:
1373
+
1374
+ : [=internal observer/next steps=]
1375
+ :: 1. [=Invoke=] |predicate| with the passed in <var ignore> value</var> and |idx|, and let
1376
+ |passed| be the returned value.
1377
+
1378
+ If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a> , then
1379
+ [=reject=] |p| with |E|, and [=AbortController/signal abort=] |controller| with |E|.
1380
+
1381
+ 1. Set |idx| to |idx| + 1.
1382
+
1383
+ 1. If |passed| is true, then [=resolve=] |p| with true, and [=AbortController/signal
1384
+ abort=] |controller|.
1385
+
1386
+ : [=internal observer/error steps=]
1387
+ :: [=Reject=] |p| with the passed in <var ignore> error</var> .
1388
+
1389
+ : [=internal observer/complete steps=]
1390
+ :: [=Resolve=] |p| with false.
1391
+
1392
+ 1. <a for=Observable lt="subscribe to an Observable">Subscribe</a> to [=this=] given |observer|
1393
+ and |internal options|.
1394
+
1395
+ 1. Return |p|.
1255
1396
</div>
1256
1397
1257
1398
<div algorithm>
0 commit comments