@@ -195,6 +195,19 @@ <h2>
195
195
}
196
196
}
197
197
</ pre >
198
+ < section >
199
+ < h3 >
200
+ Miscellaneous
201
+ </ h3 >
202
+ < p >
203
+ A < dfn > 64-bit unsigned integer</ dfn > is an integer in the range 0 to
204
+ 18446744073709551615 (2< sup > 64</ sup > − 1), inclusive.
205
+ </ p >
206
+ < p >
207
+ A < dfn > 32-bit unsigned integer</ dfn > is an integer in the range 0 to 4294967295
208
+ (2< sup > 32</ sup > − 1), inclusive.
209
+ </ p >
210
+ </ section >
198
211
< section >
199
212
< h3 >
200
213
Members
@@ -217,8 +230,10 @@ <h3>
217
230
</ dt >
218
231
< dd >
219
232
< p >
220
- A JSON object consisting of the following members, many being analogous to
221
- Notifications API features. [[NOTIFICATIONS]]
233
+ A JSON object consisting of the following members, all analogous to Notifications
234
+ API features, though sometimes with a slightly stricter type. Apart from
235
+ < code > title</ code > all members are derived from the {{NotificationOptions}}
236
+ dictionary and are expected to be maintained in tandem. [[NOTIFICATIONS]]
222
237
</ p >
223
238
< dl >
224
239
< dt >
254
269
</ p >
255
270
</ dd >
256
271
< dt >
257
- < code > url </ code > (required)
272
+ < code > navigate </ code > (required)
258
273
</ dt >
259
274
< dd >
260
275
< p >
@@ -269,6 +284,14 @@ <h3>
269
284
A string.
270
285
</ p >
271
286
</ dd >
287
+ < dt >
288
+ < code > image</ code >
289
+ </ dt >
290
+ < dd >
291
+ < p >
292
+ A string that holds a URL.
293
+ </ p >
294
+ </ dd >
272
295
< dt >
273
296
< code > icon</ code >
274
297
</ dt >
@@ -277,6 +300,38 @@ <h3>
277
300
A string that holds a URL.
278
301
</ p >
279
302
</ dd >
303
+ < dt >
304
+ < code > badge</ code >
305
+ </ dt >
306
+ < dd >
307
+ < p >
308
+ A string that holds a URL.
309
+ </ p >
310
+ </ dd >
311
+ < dt >
312
+ < code > vibrate</ code >
313
+ </ dt >
314
+ < dd >
315
+ < p >
316
+ An array of [=32-bit unsigned integers=].
317
+ </ p >
318
+ </ dd >
319
+ < dt >
320
+ < code > timestamp</ code >
321
+ </ dt >
322
+ < dd >
323
+ < p >
324
+ A [=64-bit unsigned integer=].
325
+ </ p >
326
+ </ dd >
327
+ < dt >
328
+ < code > renotify</ code >
329
+ </ dt >
330
+ < dd >
331
+ < p >
332
+ A boolean.
333
+ </ p >
334
+ </ dd >
280
335
< dt >
281
336
< code > silent</ code >
282
337
</ dt >
@@ -285,6 +340,14 @@ <h3>
285
340
A boolean.
286
341
</ p >
287
342
</ dd >
343
+ < dt >
344
+ < code > require_interaction</ code >
345
+ </ dt >
346
+ < dd >
347
+ < p >
348
+ A boolean.
349
+ </ p >
350
+ </ dd >
288
351
< dt >
289
352
< code > data</ code >
290
353
</ dt >
@@ -293,14 +356,57 @@ <h3>
293
356
Any JSON value.
294
357
</ p >
295
358
</ dd >
359
+ < dt >
360
+ < code > actions</ code >
361
+ </ dt >
362
+ < dd >
363
+ < p >
364
+ An array of JSON objects consisting of the following members, all derived from
365
+ the {{NotificationAction}} dictionary and to be maintained in tandem.
366
+ </ p >
367
+ < dl >
368
+ < dt >
369
+ < code > action</ code > (required)
370
+ </ dt >
371
+ < dd >
372
+ < p >
373
+ A string.
374
+ </ p >
375
+ </ dd >
376
+ < dt >
377
+ < code > title</ code > (required)
378
+ </ dt >
379
+ < dd >
380
+ < p >
381
+ A string.
382
+ </ p >
383
+ </ dd >
384
+ < dt >
385
+ < code > navigate</ code > (required)
386
+ </ dt >
387
+ < dd >
388
+ < p >
389
+ A string that holds a URL.
390
+ </ p >
391
+ </ dd >
392
+ < dt >
393
+ < code > icon</ code >
394
+ </ dt >
395
+ < dd >
396
+ < p >
397
+ A string that holds a URL.
398
+ </ p >
399
+ </ dd >
400
+ </ dl >
401
+ </ dd >
296
402
</ dl >
297
403
</ dd >
298
404
< dt >
299
405
< code > app_badge</ code >
300
406
</ dt >
301
407
< dd >
302
408
< p >
303
- An integer in the range 0 to 18446744073709551615 (2 < sup > 64 </ sup > − 1), inclusive .
409
+ A [=64-bit unsigned integer=] .
304
410
</ p >
305
411
< p class ="note ">
306
412
Platform conventions are likely to impose a lower limit with regards to what is
@@ -350,12 +456,8 @@ <h3>
350
456
</ li >
351
457
< li >
352
458
< p >
353
- If < var > message</ var > ["`web_push`"] does not [=map/exist=], then return failure.
354
- </ p >
355
- </ li >
356
- < li >
357
- < p >
358
- If < var > message</ var > ["`web_push`"] is not 8030, then return failure.
459
+ If < var > message</ var > ["`web_push`"] does not [=map/exist=] or is not 8030, then
460
+ return failure.
359
461
</ p >
360
462
</ li >
361
463
< li >
@@ -399,24 +501,21 @@ <h3>
399
501
</ li >
400
502
< li >
401
503
< p >
402
- If < var > notificationInput</ var > ["`dir`"] [=map/exists=] and
403
- < var > notificationInput</ var > ["`dir`"] is "`auto`", "`ltr`", or "`rtl`", then set
404
- < var > notificationOptions</ var > ["{{NotificationOptions/dir}}"] to
405
- < var > notificationInput</ var > ["`dir`"].
504
+ If < var > notificationInput</ var > ["`dir`"] [=map/exists=] and is "`auto`", "`ltr`",
505
+ or "`rtl`", then set < var > notificationOptions</ var > ["{{NotificationOptions/dir}}"]
506
+ to < var > notificationInput</ var > ["`dir`"].
406
507
</ p >
407
508
</ li >
408
509
< li >
409
510
< p >
410
- If < var > notificationInput</ var > ["`lang`"] [=map/exists=] and
411
- < var > notificationInput</ var > ["`lang`"] is a string, then set
511
+ If < var > notificationInput</ var > ["`lang`"] [=map/exists=] and is a string, then set
412
512
< var > notificationOptions</ var > ["{{NotificationOptions/lang}}"] to
413
513
< var > notificationInput</ var > ["`lang`"].
414
514
</ p >
415
515
</ li >
416
516
< li >
417
517
< p >
418
- If < var > notificationInput</ var > ["`body`"] [=map/exists=] and
419
- < var > notificationInput</ var > ["`body`"] is a string, then set
518
+ If < var > notificationInput</ var > ["`body`"] [=map/exists=] and is a string, then set
420
519
< var > notificationOptions</ var > ["{{NotificationOptions/body}}"] to
421
520
< var > notificationInput</ var > ["`body`"].
422
521
</ p >
@@ -429,28 +528,70 @@ <h3>
429
528
</ li >
430
529
< li >
431
530
< p >
432
- If < var > notificationInput</ var > ["`tag`"] [=map/exists=] and
433
- < var > notificationInput</ var > ["`tag`"] is a string, then set
531
+ If < var > notificationInput</ var > ["`tag`"] [=map/exists=] and is a string, then set
434
532
< var > notificationOptions</ var > ["{{NotificationOptions/tag}}"] to
435
533
< var > notificationInput</ var > ["`tag`"].
436
534
</ p >
437
535
</ li >
438
536
< li >
439
537
< p >
440
- If < var > notificationInput</ var > ["`icon`"] [=map/exists=] and
441
- < var > notificationInput</ var > ["`icon`"] is a string, then set
538
+ If < var > notificationInput</ var > ["`image`"] [=map/exists=] and is a string, then set
539
+ < var > notificationOptions</ var > ["{{NotificationOptions/image}}"] to
540
+ < var > notificationInput</ var > ["`image`"], [=string/converted=].
541
+ </ p >
542
+ </ li >
543
+ < li >
544
+ < p >
545
+ If < var > notificationInput</ var > ["`icon`"] [=map/exists=] and is a string, then set
442
546
< var > notificationOptions</ var > ["{{NotificationOptions/icon}}"] to
443
547
< var > notificationInput</ var > ["`icon`"], [=string/converted=].
444
548
</ p >
445
549
</ li >
446
550
< li >
447
551
< p >
448
- If < var > notificationInput</ var > ["`silent`"] [=map/exists=] and
449
- < var > notificationInput</ var > ["`silent`"] is a boolean, then set
450
- < var > notificationOptions</ var > ["{{NotificationOptions/silent}}"] to
552
+ If < var > notificationInput</ var > ["`badge`"] [=map/exists=] and is a string, then set
553
+ < var > notificationOptions</ var > ["{{NotificationOptions/badge}}"] to
554
+ < var > notificationInput</ var > ["`badge`"], [=string/converted=].
555
+ </ p >
556
+ </ li >
557
+ < li >
558
+ < p >
559
+ If < var > notificationInput</ var > ["`vibrate`"] [=map/exists=] and is a [=/list=] of
560
+ which each [=list/item=] is a [=32-bit unsigned integer=], then set
561
+ < var > notificationOptions</ var > ["{{NotificationOptions/vibrate}}"] to
562
+ < var > notificationInput</ var > ["`vibrate`"].
563
+ </ p >
564
+ </ li >
565
+ < li >
566
+ < p >
567
+ If < var > notificationInput</ var > ["`timestamp`"] [=map/exists=] and is a [=64-bit
568
+ unsigned integer=], then set
569
+ < var > notificationOptions</ var > ["{{NotificationOptions/timestamp}}"] to
570
+ < var > notificationInput</ var > ["`timestamp`"].
571
+ </ p >
572
+ </ li >
573
+ < li >
574
+ < p >
575
+ If < var > notificationInput</ var > ["`renotify`"] [=map/exists=] and is a boolean, then
576
+ set < var > notificationOptions</ var > ["{{NotificationOptions/renotify}}"] to
577
+ < var > notificationInput</ var > ["`renotify`"].
578
+ </ p >
579
+ </ li >
580
+ < li >
581
+ < p >
582
+ If < var > notificationInput</ var > ["`silent`"] [=map/exists=] and is a boolean, then
583
+ set < var > notificationOptions</ var > ["{{NotificationOptions/silent}}"] to
451
584
< var > notificationInput</ var > ["`silent`"].
452
585
</ p >
453
586
</ li >
587
+ < li >
588
+ < p >
589
+ If < var > notificationInput</ var > ["`require_interaction`"] [=map/exists=] and is a
590
+ boolean, then set
591
+ < var > notificationOptions</ var > ["{{NotificationOptions/requireInteraction}}"] to
592
+ < var > notificationInput</ var > ["`require_interaction`"].
593
+ </ p >
594
+ </ li >
454
595
< li >
455
596
< p >
456
597
If < var > notificationInput</ var > ["`data`"] [=map/exists=], then set
@@ -459,6 +600,79 @@ <h3>
459
600
< var > notificationInput</ var > ["`data`"].
460
601
</ p >
461
602
</ li >
603
+ < li >
604
+ < p >
605
+ If < var > notificationInput</ var > ["`actions`"] [=map/exists=] and is a [=/list=]:
606
+ </ p >
607
+ < ol >
608
+ < li >
609
+ < p >
610
+ Let < var > notificationActions</ var > be « ».
611
+ </ p >
612
+ </ li >
613
+ < li >
614
+ < p >
615
+ [=list/For each=] < var > actionInput</ var > of
616
+ < var > notificationInput</ var > ["`actions`"]:
617
+ </ p >
618
+ < ol >
619
+ < li >
620
+ < p >
621
+ If < var > actionInput</ var > ["`action`"] does not [=map/exist=] or is not a
622
+ string, then [=iteration/continue=].
623
+ </ p >
624
+ </ li >
625
+ < li >
626
+ < p >
627
+ If < var > actionInput</ var > ["`title`"] does not [=map/exist=] or is not a
628
+ string, then [=iteration/continue=].
629
+ </ p >
630
+ </ li >
631
+ < li >
632
+ < p >
633
+ If < var > actionInput</ var > ["`navigate`"] does not [=map/exist=] or is not a
634
+ string, then [=iteration/continue=].
635
+ </ p >
636
+ </ li >
637
+ <!-- We still need to check the final action for a navigation URL regardless, but failing early seems good as per above. -->
638
+ < li >
639
+ < p >
640
+ Let < var > actionNavigate</ var > be < var > actionInput</ var > ["`navigate`"],
641
+ [=string/converted=].
642
+ </ p >
643
+ </ li >
644
+ < li >
645
+ < p >
646
+ Let < var > notificationAction</ var > be the {{NotificationAction}} dictionary
647
+ «[ "{{NotificationAction/action}}" → < var > actionInput</ var > ["`action`"],
648
+ "{{NotificationAction/title}}" → < var > actionInput</ var > ["`title`"],
649
+ "{{NotificationAction/navigate}}" → < var > actionNavigate</ var > ]».
650
+ </ p >
651
+ </ li >
652
+ <!-- Initialize the dictionary mostly at once here to account for required members. -->
653
+ < li >
654
+ < p >
655
+ If < var > actionInput</ var > ["`icon`"] [=map/exists=] and is a string, then
656
+ set < var > notificationAction</ var > ["{{NotificationAction/icon}}"] to
657
+ < var > actionInput</ var > ["`icon`"], [=string/converted=].
658
+ </ p >
659
+ </ li >
660
+ < li >
661
+ < p >
662
+ [=list/Append=] < var > notificationAction</ var > to
663
+ < var > notificationActions</ var > .
664
+ </ p >
665
+ </ li >
666
+ </ ol >
667
+ </ li >
668
+ < li >
669
+ < p >
670
+ Set < var > notificationOptions</ var > ["{{NotificationOptions/actions}}"] to
671
+ < var > notificationActions</ var > .
672
+ </ p >
673
+ </ li >
674
+ </ ol >
675
+ </ li >
462
676
< li >
463
677
< p >
464
678
Let < var > notification</ var > be the result of < a data-lt =
@@ -474,6 +688,12 @@ <h3>
474
688
failure.
475
689
</ p >
476
690
</ li >
691
+ < li >
692
+ < p >
693
+ If the [=action/navigation URL=] of any [=/action=] of < var > notification</ var > 's
694
+ [=notification/actions=] is null, then return failure.
695
+ </ p >
696
+ </ li >
477
697
< li >
478
698
< p >
479
699
Let < var > appBadge</ var > be null.
482
702
< li >
483
703
< p >
484
704
If < var > message</ var > ["`app_badge`"] [=map/exists=] and
485
- < var > message</ var > ["`app_badge`"] is an integer in the range 0 to
486
- 18446744073709551615 (2< sup > 64</ sup > − 1), inclusive, then set < var > appBadge</ var >
487
- to < var > message</ var > ["`app_badge`"].
705
+ < var > message</ var > ["`app_badge`"] is a [=64-bit unsigned integer=], then set
706
+ < var > appBadge</ var > to < var > message</ var > ["`app_badge`"].
488
707
</ p > <!-- unsigned long long in Web IDL -->
489
708
</ li >
490
709
< li >
0 commit comments