ServiceWorkerGlobalScope.hx 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Copyright (C)2005-2019 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. // This file is generated from mozilla\ServiceWorkerGlobalScope.webidl. Do not edit!
  23. package js.html;
  24. import js.lib.Promise;
  25. /**
  26. The `ServiceWorkerGlobalScope` interface of the ServiceWorker API represents the global execution context of a service worker.
  27. Documentation [ServiceWorkerGlobalScope](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
  28. @see <https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope>
  29. **/
  30. @:native("ServiceWorkerGlobalScope")
  31. extern class ServiceWorkerGlobalScope extends WorkerGlobalScope {
  32. /**
  33. Contains the `Clients` object associated with the service worker.
  34. **/
  35. var clients(default,null) : Clients;
  36. /**
  37. Contains the `ServiceWorkerRegistration` object that represents the service worker's registration.
  38. **/
  39. var registration(default,null) : ServiceWorkerRegistration;
  40. /**
  41. An event handler fired whenever an `install` event occurs — when a `ServiceWorkerRegistration` acquires a new `ServiceWorkerRegistration.installing` worker.
  42. **/
  43. var oninstall : haxe.Constraints.Function;
  44. /**
  45. An event handler fired whenever an `activate` event occurs — when a `ServiceWorkerRegistration` acquires a new `ServiceWorkerRegistration.active` worker.
  46. **/
  47. var onactivate : haxe.Constraints.Function;
  48. /**
  49. An event handler fired whenever a `fetch` event occurs — when a `GlobalFetch.fetch` is called.
  50. **/
  51. var onfetch : haxe.Constraints.Function;
  52. /**
  53. An event handler fired whenever a `message` event occurs — when incoming messages are received. Controlled pages can use the `MessagePort.postMessage()` method to send messages to service workers. The service worker can optionally send a response back via the `MessagePort` exposed in `event.data.port`, corresponding to the controlled page.
  54. **/
  55. var onmessage : haxe.Constraints.Function;
  56. /**
  57. An event handler fired whenever a `push` event occurs — when a server push notification is received.
  58. **/
  59. var onpush : haxe.Constraints.Function;
  60. /**
  61. An event handler fired whenever a `pushsubscriptionchange` event occurs — when a push subscription has been invalidated, or is about to be invalidated (e.g. when a push service sets an expiration time.)
  62. **/
  63. var onpushsubscriptionchange : haxe.Constraints.Function;
  64. /**
  65. An event handler fired whenever a `notificationclick` event occurs — when a user clicks on a displayed notification.
  66. **/
  67. var onnotificationclick : haxe.Constraints.Function;
  68. /**
  69. An event handler fired whenever a `notificationclose` event occurs — when a user closes a displayed notification.
  70. **/
  71. var onnotificationclose : haxe.Constraints.Function;
  72. /**
  73. Allows the current service worker registration to progress from waiting to active state while service worker clients are using it.
  74. @throws DOMError
  75. **/
  76. function skipWaiting() : Promise<Void>;
  77. }