WorkerGlobalScope.hx 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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\WorkerGlobalScope.webidl. Do not edit!
  23. package js.html;
  24. import js.lib.Promise;
  25. /**
  26. The `WorkerGlobalScope` interface of the Web Workers API is an interface representing the scope of any worker. Workers have no browsing context; this scope contains the information usually conveyed by `Window` objects — in this case event handlers, the console or the associated `WorkerNavigator` object. Each `WorkerGlobalScope` has its own event loop.
  27. Documentation [WorkerGlobalScope](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope$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/WorkerGlobalScope>
  29. **/
  30. @:native("WorkerGlobalScope")
  31. extern class WorkerGlobalScope extends EventTarget {
  32. /**
  33. Returns a reference to the `WorkerGlobalScope` itself. Most of the time it is a specific scope like `DedicatedWorkerGlobalScope`,  `SharedWorkerGlobalScope` or `ServiceWorkerGlobalScope`.
  34. **/
  35. var self(default,null) : WorkerGlobalScope;
  36. /**
  37. Returns the `WorkerLocation` associated with the worker. It is a specific location object, mostly a subset of the `Location` for browsing scopes, but adapted to workers.
  38. **/
  39. var location(default,null) : WorkerLocation;
  40. var navigator(default,null) : WorkerNavigator;
  41. /**
  42. Is an `EventHandler` representing the code to be called when the `error` event is raised.
  43. **/
  44. var onerror : haxe.extern.EitherType<Event,String> -> String -> Int -> Int -> Dynamic -> Dynamic;
  45. /**
  46. Is an `EventHandler` representing the code to be called when the `offline` event is raised.
  47. **/
  48. var onoffline : haxe.Constraints.Function;
  49. /**
  50. Is an `EventHandler` representing the code to be called when the `online` event is raised.
  51. **/
  52. var ononline : haxe.Constraints.Function;
  53. /**
  54. Returns the `Performance` associated with the worker. It is a regular performance object, except that only a subset of its property and methods are available to workers.
  55. **/
  56. var performance(default,null) : Performance;
  57. var crypto(default,null) : Crypto;
  58. var origin(default,null) : String;
  59. var isSecureContext(default,null) : Bool;
  60. var indexedDB(default,null) : js.html.idb.Factory;
  61. var caches(default,null) : CacheStorage;
  62. /**
  63. Imports one or more scripts into the worker's scope. You can specify as many as you'd like, separated by commas. For example:` importScripts('foo.js', 'bar.js');`
  64. @throws DOMError
  65. **/
  66. function importScripts( urls : haxe.extern.Rest<String> ) : Void;
  67. /**
  68. Allows you to write a message to stdout — i.e. in your terminal. This is the same as Firefox's `window.dump`, but for workers.
  69. **/
  70. function dump( ?str : String ) : Void;
  71. /** @throws DOMError */
  72. function btoa( btoa : String ) : String;
  73. /** @throws DOMError */
  74. function atob( atob : String ) : String;
  75. /** @throws DOMError */
  76. @:overload( function( handler : haxe.Constraints.Function, timeout : Int = 0, arguments : haxe.extern.Rest<Dynamic> ) : Int {} )
  77. function setTimeout( handler : String, timeout : Int = 0, unused : haxe.extern.Rest<Dynamic> ) : Int;
  78. function clearTimeout( handle : Int = 0 ) : Void;
  79. /** @throws DOMError */
  80. @:overload( function( handler : haxe.Constraints.Function, timeout : Int = 0, arguments : haxe.extern.Rest<Dynamic> ) : Int {} )
  81. function setInterval( handler : String, timeout : Int = 0, unused : haxe.extern.Rest<Dynamic> ) : Int;
  82. function clearInterval( handle : Int = 0 ) : Void;
  83. /** @throws DOMError */
  84. @:overload( function( aImage : VideoElement) : Promise<ImageBitmap> {} )
  85. @:overload( function( aImage : CanvasElement) : Promise<ImageBitmap> {} )
  86. @:overload( function( aImage : Blob) : Promise<ImageBitmap> {} )
  87. @:overload( function( aImage : ImageData) : Promise<ImageBitmap> {} )
  88. @:overload( function( aImage : CanvasRenderingContext2D) : Promise<ImageBitmap> {} )
  89. @:overload( function( aImage : ImageBitmap) : Promise<ImageBitmap> {} )
  90. @:overload( function( aImage : js.lib.ArrayBufferView) : Promise<ImageBitmap> {} )
  91. @:overload( function( aImage : js.lib.ArrayBuffer) : Promise<ImageBitmap> {} )
  92. @:overload( function( aImage : VideoElement, aSx : Int, aSy : Int, aSw : Int, aSh : Int) : Promise<ImageBitmap> {} )
  93. @:overload( function( aImage : CanvasElement, aSx : Int, aSy : Int, aSw : Int, aSh : Int) : Promise<ImageBitmap> {} )
  94. @:overload( function( aImage : Blob, aSx : Int, aSy : Int, aSw : Int, aSh : Int) : Promise<ImageBitmap> {} )
  95. @:overload( function( aImage : ImageData, aSx : Int, aSy : Int, aSw : Int, aSh : Int) : Promise<ImageBitmap> {} )
  96. @:overload( function( aImage : CanvasRenderingContext2D, aSx : Int, aSy : Int, aSw : Int, aSh : Int) : Promise<ImageBitmap> {} )
  97. @:overload( function( aImage : ImageBitmap, aSx : Int, aSy : Int, aSw : Int, aSh : Int) : Promise<ImageBitmap> {} )
  98. @:overload( function( aImage : js.lib.ArrayBufferView, aSx : Int, aSy : Int, aSw : Int, aSh : Int) : Promise<ImageBitmap> {} )
  99. @:overload( function( aImage : js.lib.ArrayBuffer, aSx : Int, aSy : Int, aSw : Int, aSh : Int) : Promise<ImageBitmap> {} )
  100. @:overload( function( aImage : VideoElement, aOffset : Int, aLength : Int, aFormat : ImageBitmapFormat, aLayout : Array<ChannelPixelLayout>) : Promise<ImageBitmap> {} )
  101. @:overload( function( aImage : CanvasElement, aOffset : Int, aLength : Int, aFormat : ImageBitmapFormat, aLayout : Array<ChannelPixelLayout>) : Promise<ImageBitmap> {} )
  102. @:overload( function( aImage : Blob, aOffset : Int, aLength : Int, aFormat : ImageBitmapFormat, aLayout : Array<ChannelPixelLayout>) : Promise<ImageBitmap> {} )
  103. @:overload( function( aImage : ImageData, aOffset : Int, aLength : Int, aFormat : ImageBitmapFormat, aLayout : Array<ChannelPixelLayout>) : Promise<ImageBitmap> {} )
  104. @:overload( function( aImage : CanvasRenderingContext2D, aOffset : Int, aLength : Int, aFormat : ImageBitmapFormat, aLayout : Array<ChannelPixelLayout>) : Promise<ImageBitmap> {} )
  105. @:overload( function( aImage : ImageBitmap, aOffset : Int, aLength : Int, aFormat : ImageBitmapFormat, aLayout : Array<ChannelPixelLayout>) : Promise<ImageBitmap> {} )
  106. @:overload( function( aImage : js.lib.ArrayBufferView, aOffset : Int, aLength : Int, aFormat : ImageBitmapFormat, aLayout : Array<ChannelPixelLayout>) : Promise<ImageBitmap> {} )
  107. @:overload( function( aImage : js.lib.ArrayBuffer, aOffset : Int, aLength : Int, aFormat : ImageBitmapFormat, aLayout : Array<ChannelPixelLayout>) : Promise<ImageBitmap> {} )
  108. @:overload( function( aImage : ImageElement ) : Promise<ImageBitmap> {} )
  109. @:overload( function( aImage : ImageElement, aSx : Int, aSy : Int, aSw : Int, aSh : Int ) : Promise<ImageBitmap> {} )
  110. function createImageBitmap( aImage : ImageElement, aOffset : Int, aLength : Int, aFormat : ImageBitmapFormat, aLayout : Array<ChannelPixelLayout> ) : Promise<ImageBitmap>;
  111. @:overload( function( input : String, ?init : RequestInit) : Promise<Response> {} )
  112. function fetch( input : Request, ?init : RequestInit ) : Promise<Response>;
  113. }