Window.hx 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. /*
  2. * Copyright (C)2005-2017 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\Window.webidl. Do not edit!
  23. package js.html;
  24. /**
  25. The `window` object represents a window containing a DOM document; the `document` property points to the DOM document loaded in that window.
  26. Documentation [Window](https://developer.mozilla.org/en-US/docs/Web/API/Window) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/Window$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
  27. @see <https://developer.mozilla.org/en-US/docs/Web/API/Window>
  28. **/
  29. @:native("Window")
  30. extern class Window extends EventTarget
  31. {
  32. /**
  33. Returns a reference to the current window.
  34. **/
  35. var window(default,null) : Window;
  36. /**
  37. Returns an object reference to the window object itself.
  38. **/
  39. var self(default,null) : Window;
  40. /**
  41. Returns a reference to the document that the window contains.
  42. **/
  43. var document(default,null) : HTMLDocument;
  44. /**
  45. Gets/sets the name of the window.
  46. **/
  47. var name : String;
  48. /**
  49. Gets/sets the location, or current URL, of the window object.
  50. **/
  51. var location(default,null) : Location;
  52. /**
  53. Returns a reference to the history object.
  54. **/
  55. var history(default,null) : History;
  56. /**
  57. Returns the locationbar object, whose visibility can be toggled in the window.
  58. **/
  59. var locationbar(default,null) : BarProp;
  60. /**
  61. Returns the menubar object, whose visibility can be toggled in the window.
  62. **/
  63. var menubar(default,null) : BarProp;
  64. /**
  65. Returns the personalbar object, whose visibility can be toggled in the window.
  66. **/
  67. var personalbar(default,null) : BarProp;
  68. /**
  69. Returns the scrollbars object, whose visibility can be toggled in the window.
  70. **/
  71. var scrollbars(default,null) : BarProp;
  72. /**
  73. Returns the statusbar object, whose visibility can be toggled in the window.
  74. **/
  75. var statusbar(default,null) : BarProp;
  76. /**
  77. Returns the toolbar object, whose visibility can be toggled in the window.
  78. **/
  79. var toolbar(default,null) : BarProp;
  80. /**
  81. Gets/sets the text in the statusbar at the bottom of the browser.
  82. **/
  83. var status : String;
  84. /**
  85. This property indicates whether the current window is closed or not.
  86. **/
  87. var closed(default,null) : Bool;
  88. /**
  89. Returns an array of the subframes in the current window.
  90. **/
  91. var frames(default,null) : Window;
  92. /**
  93. Returns the number of frames in the window. See also `window.frames`.
  94. **/
  95. var length(default,null) : Int;
  96. /**
  97. Returns a reference to the topmost window in the window hierarchy. This property is read only.
  98. **/
  99. var top(default,null) : Window;
  100. /**
  101. Returns a reference to the window that opened this current window.
  102. **/
  103. var opener : Dynamic;
  104. /**
  105. Returns a reference to the parent of the current window or subframe.
  106. **/
  107. var parent(default,null) : Window;
  108. /**
  109. Returns the element in which the window is embedded, or null if the window is not embedded.
  110. **/
  111. var frameElement(default,null) : Element;
  112. /**
  113. Returns a reference to the navigator object.
  114. **/
  115. var navigator(default,null) : Navigator;
  116. /**
  117. Returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation.
  118. **/
  119. var orientation(default,null) : Int;
  120. var onorientationchange : haxe.Constraints.Function;
  121. /**
  122. Returns a reference to the screen object associated with the window.
  123. **/
  124. var screen(default,null) : Screen;
  125. /**
  126. Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.
  127. **/
  128. var innerWidth : Dynamic;
  129. /**
  130. Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.
  131. **/
  132. var innerHeight : Dynamic;
  133. /**
  134. Returns the number of pixels that the document has already been scrolled horizontally.
  135. **/
  136. var scrollX(default,null) : Int;
  137. var pageXOffset(default,null) : Int;
  138. /**
  139. Returns the number of pixels that the document has already been scrolled vertically.
  140. **/
  141. var scrollY(default,null) : Int;
  142. var pageYOffset(default,null) : Int;
  143. /**
  144. Returns the horizontal distance of the left border of the user's browser from the left side of the screen.
  145. **/
  146. var screenX : Dynamic;
  147. /**
  148. Returns the vertical distance of the top border of the user's browser from the top side of the screen.
  149. **/
  150. var screenY : Dynamic;
  151. /**
  152. Gets the width of the outside of the browser window.
  153. **/
  154. var outerWidth : Dynamic;
  155. /**
  156. Gets the height of the outside of the browser window.
  157. **/
  158. var outerHeight : Dynamic;
  159. /**
  160. Provides a hosting area for performance related attributes.
  161. **/
  162. var performance(default,null) : Performance;
  163. /**
  164. Returns the ratio between physical pixels and device independent pixels in the current display.
  165. **/
  166. var devicePixelRatio(default,null) : Float;
  167. /**
  168. The maximum offset that the window can be scrolled to horizontally, that is the document width minus the viewport width.
  169. **/
  170. var scrollMaxX(default,null) : Int;
  171. /**
  172. The maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height).
  173. **/
  174. var scrollMaxY(default,null) : Int;
  175. /**
  176. This property indicates whether the window is displayed in full screen or not.
  177. **/
  178. var fullScreen : Bool;
  179. var onwheel : haxe.Constraints.Function;
  180. var ondevicemotion : haxe.Constraints.Function;
  181. var ondeviceorientation : haxe.Constraints.Function;
  182. var onabsolutedeviceorientation : haxe.Constraints.Function;
  183. var ondeviceproximity : haxe.Constraints.Function;
  184. var onuserproximity : haxe.Constraints.Function;
  185. var ondevicelight : haxe.Constraints.Function;
  186. /**
  187. Returns a reference to the content element in the current window. The obsolete variant with underscore is no longer available from Web content.
  188. **/
  189. var content(default,null) : Dynamic;
  190. /**
  191. Returns a reference to the console object which provides access to the browser's debugging console.
  192. **/
  193. var console(default,null) : Console;
  194. /**
  195. Returns the browser crypto object.
  196. **/
  197. var crypto(default,null) : Crypto;
  198. var onabort : haxe.Constraints.Function;
  199. var onblur : haxe.Constraints.Function;
  200. var onfocus : haxe.Constraints.Function;
  201. var oncanplay : haxe.Constraints.Function;
  202. var oncanplaythrough : haxe.Constraints.Function;
  203. var onchange : haxe.Constraints.Function;
  204. var onclick : haxe.Constraints.Function;
  205. var oncontextmenu : haxe.Constraints.Function;
  206. var ondblclick : haxe.Constraints.Function;
  207. var ondrag : haxe.Constraints.Function;
  208. var ondragend : haxe.Constraints.Function;
  209. var ondragenter : haxe.Constraints.Function;
  210. var ondragleave : haxe.Constraints.Function;
  211. var ondragover : haxe.Constraints.Function;
  212. var ondragstart : haxe.Constraints.Function;
  213. var ondrop : haxe.Constraints.Function;
  214. var ondurationchange : haxe.Constraints.Function;
  215. var onemptied : haxe.Constraints.Function;
  216. var onended : haxe.Constraints.Function;
  217. var oninput : haxe.Constraints.Function;
  218. var oninvalid : haxe.Constraints.Function;
  219. var onkeydown : haxe.Constraints.Function;
  220. var onkeypress : haxe.Constraints.Function;
  221. var onkeyup : haxe.Constraints.Function;
  222. var onload : haxe.Constraints.Function;
  223. var onloadeddata : haxe.Constraints.Function;
  224. var onloadedmetadata : haxe.Constraints.Function;
  225. var onloadstart : haxe.Constraints.Function;
  226. var onmousedown : haxe.Constraints.Function;
  227. var onmouseenter : haxe.Constraints.Function;
  228. var onmouseleave : haxe.Constraints.Function;
  229. var onmousemove : haxe.Constraints.Function;
  230. var onmouseout : haxe.Constraints.Function;
  231. var onmouseover : haxe.Constraints.Function;
  232. var onmouseup : haxe.Constraints.Function;
  233. var onpause : haxe.Constraints.Function;
  234. var onplay : haxe.Constraints.Function;
  235. var onplaying : haxe.Constraints.Function;
  236. var onprogress : haxe.Constraints.Function;
  237. var onratechange : haxe.Constraints.Function;
  238. var onreset : haxe.Constraints.Function;
  239. var onresize : haxe.Constraints.Function;
  240. var onscroll : haxe.Constraints.Function;
  241. var onseeked : haxe.Constraints.Function;
  242. var onseeking : haxe.Constraints.Function;
  243. var onselect : haxe.Constraints.Function;
  244. var onshow : haxe.Constraints.Function;
  245. var onstalled : haxe.Constraints.Function;
  246. var onsubmit : haxe.Constraints.Function;
  247. var onsuspend : haxe.Constraints.Function;
  248. var ontimeupdate : haxe.Constraints.Function;
  249. var onvolumechange : haxe.Constraints.Function;
  250. var onwaiting : haxe.Constraints.Function;
  251. var onpointercancel : haxe.Constraints.Function;
  252. var onpointerdown : haxe.Constraints.Function;
  253. var onpointerup : haxe.Constraints.Function;
  254. var onpointermove : haxe.Constraints.Function;
  255. var onpointerout : haxe.Constraints.Function;
  256. var onpointerover : haxe.Constraints.Function;
  257. var onpointerenter : haxe.Constraints.Function;
  258. var onpointerleave : haxe.Constraints.Function;
  259. var ongotpointercapture : haxe.Constraints.Function;
  260. var onlostpointercapture : haxe.Constraints.Function;
  261. var onfullscreenchange : haxe.Constraints.Function;
  262. var onfullscreenerror : haxe.Constraints.Function;
  263. var onpointerlockchange : haxe.Constraints.Function;
  264. var onpointerlockerror : haxe.Constraints.Function;
  265. var indexedDB(default,null) : js.html.idb.Factory;
  266. var onerror : haxe.extern.EitherType<Event,String> -> String -> Int -> Int -> Dynamic -> Bool;
  267. /**
  268. Returns a `SpeechSynthesis` object, which is the entry point into using Web Speech API speech synthesis functionality.
  269. **/
  270. var speechSynthesis(default,null) : SpeechSynthesis;
  271. var ontouchstart : haxe.Constraints.Function;
  272. var ontouchend : haxe.Constraints.Function;
  273. var ontouchmove : haxe.Constraints.Function;
  274. var ontouchcancel : haxe.Constraints.Function;
  275. var onafterprint : haxe.Constraints.Function;
  276. var onbeforeprint : haxe.Constraints.Function;
  277. var onbeforeunload : Event -> String;
  278. var onhashchange : haxe.Constraints.Function;
  279. var onlanguagechange : haxe.Constraints.Function;
  280. var onmessage : haxe.Constraints.Function;
  281. var onoffline : haxe.Constraints.Function;
  282. var ononline : haxe.Constraints.Function;
  283. var onpagehide : haxe.Constraints.Function;
  284. var onpageshow : haxe.Constraints.Function;
  285. var onpopstate : haxe.Constraints.Function;
  286. var onstorage : haxe.Constraints.Function;
  287. var onunload : haxe.Constraints.Function;
  288. /**
  289. Returns a reference to the local storage object used to store data that may only be accessed by the origin that created it.
  290. **/
  291. var localStorage(default,null) : Storage;
  292. /**
  293. Returns a storage object for storing data within a single page session.
  294. **/
  295. var sessionStorage(default,null) : Storage;
  296. /** @throws DOMError */
  297. /**
  298. Closes the current window.
  299. **/
  300. function close() : Void;
  301. /** @throws DOMError */
  302. /**
  303. This method stops window loading.
  304. **/
  305. function stop() : Void;
  306. /** @throws DOMError */
  307. /**
  308. Sets focus on the current window.
  309. **/
  310. function focus() : Void;
  311. /** @throws DOMError */
  312. /**
  313. Sets focus away from the window.
  314. **/
  315. function blur() : Void;
  316. /** @throws DOMError */
  317. /**
  318. Opens a new window.
  319. **/
  320. function open( ?url : String = "", ?target : String = "", ?features : String = "" ) : Window;
  321. /** @throws DOMError */
  322. @:overload( function() : Void {} )
  323. /**
  324. Displays an alert dialog.
  325. **/
  326. function alert( message : String ) : Void;
  327. /** @throws DOMError */
  328. /**
  329. Displays a dialog with a message that the user needs to respond to.
  330. **/
  331. function confirm( ?message : String = "" ) : Bool;
  332. /** @throws DOMError */
  333. /**
  334. Returns the text entered by the user in a prompt dialog.
  335. **/
  336. function prompt( ?message : String = "", ?default_ : String = "" ) : String;
  337. /** @throws DOMError */
  338. /**
  339. Opens the Print Dialog to print the current document.
  340. **/
  341. function print() : Void;
  342. /** @throws DOMError */
  343. /**
  344. Provides a secure means for one window to send a string of data to another window, which need not be within the same domain as the first.
  345. **/
  346. function postMessage( message : Dynamic, targetOrigin : String, ?transfer : Array<Dynamic> ) : Void;
  347. /**
  348. Registers the window to capture all events of the specified type.
  349. **/
  350. function captureEvents() : Void;
  351. /**
  352. Releases the window from trapping events of a specific type.
  353. **/
  354. function releaseEvents() : Void;
  355. /** @throws DOMError */
  356. /**
  357. Returns the selection object representing the selected item(s).
  358. **/
  359. function getSelection() : Selection;
  360. /** @throws DOMError */
  361. /**
  362. Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.
  363. **/
  364. function getComputedStyle( elt : Element, ?pseudoElt : String = "" ) : CSSStyleDeclaration;
  365. /** @throws DOMError */
  366. /**
  367. Returns a `MediaQueryList` object representing the specified media query string.
  368. **/
  369. function matchMedia( query : String ) : MediaQueryList;
  370. /** @throws DOMError */
  371. /**
  372. Moves the window to the specified coordinates.
  373. **/
  374. function moveTo( x : Int, y : Int ) : Void;
  375. /** @throws DOMError */
  376. /**
  377. Moves the current window by a specified amount.
  378. **/
  379. function moveBy( x : Int, y : Int ) : Void;
  380. /** @throws DOMError */
  381. /**
  382. Dynamically resizes window.
  383. **/
  384. function resizeTo( x : Int, y : Int ) : Void;
  385. /** @throws DOMError */
  386. /**
  387. Resizes the current window by a certain amount.
  388. **/
  389. function resizeBy( x : Int, y : Int ) : Void;
  390. @:overload( function( x : Float, y : Float ) : Void {} )
  391. /**
  392. Scrolls the window to a particular place in the document.
  393. **/
  394. function scroll( ?options : ScrollToOptions ) : Void;
  395. @:overload( function( x : Float, y : Float ) : Void {} )
  396. /**
  397. Scrolls to a particular set of coordinates in the document.
  398. **/
  399. function scrollTo( ?options : ScrollToOptions ) : Void;
  400. @:overload( function( x : Float, y : Float ) : Void {} )
  401. /**
  402. Scrolls the document in the window by the given amount.
  403. **/
  404. function scrollBy( ?options : ScrollToOptions ) : Void;
  405. /** @throws DOMError */
  406. function requestAnimationFrame( callback : Float -> Void ) : Int;
  407. /** @throws DOMError */
  408. function cancelAnimationFrame( handle : Int ) : Void;
  409. /** @throws DOMError */
  410. /**
  411. Gets default computed style for the specified element, ignoring author stylesheets.
  412. **/
  413. function getDefaultComputedStyle( elt : Element, ?pseudoElt : String = "" ) : CSSStyleDeclaration;
  414. /**
  415. Scrolls the document by the given number of lines.
  416. **/
  417. function scrollByLines( numLines : Int, ?options : ScrollOptions ) : Void;
  418. /**
  419. Scrolls the current document by the specified number of pages.
  420. **/
  421. function scrollByPages( numPages : Int, ?options : ScrollOptions ) : Void;
  422. /** @throws DOMError */
  423. /**
  424. Sizes the window according to its content.
  425. **/
  426. function sizeToContent() : Void;
  427. /**
  428. Updates the state of commands of the current chrome window (UI).
  429. **/
  430. function updateCommands( action : String, ?sel : Selection, ?reason : Int = 0 ) : Void;
  431. /** @throws DOMError */
  432. /**
  433. Searches for a given string in a window.
  434. **/
  435. function find( ?str : String = "", ?caseSensitive : Bool = false, ?backwards : Bool = false, ?wrapAround : Bool = false, ?wholeWord : Bool = false, ?searchInFrames : Bool = false, ?showDialog : Bool = false ) : Bool;
  436. /**
  437. Writes a message to the console.
  438. **/
  439. function dump( str : String ) : Void;
  440. /**
  441. Toggles a user's ability to resize a window.
  442. **/
  443. function setResizable( resizable : Bool ) : Void;
  444. /** @throws DOMError */
  445. function fetch( input : haxe.extern.EitherType<Request,String>, ?init : RequestInit ) : Promise<Response>;
  446. /** @throws DOMError */
  447. @:overload( function( aImage : haxe.extern.EitherType<ImageElement,haxe.extern.EitherType<VideoElement,haxe.extern.EitherType<CanvasElement,haxe.extern.EitherType<Blob,haxe.extern.EitherType<ImageData,haxe.extern.EitherType<CanvasRenderingContext2D,ImageBitmap>>>>>> ) : Promise<ImageBitmap> {} )
  448. function createImageBitmap( aImage : haxe.extern.EitherType<ImageElement,haxe.extern.EitherType<VideoElement,haxe.extern.EitherType<CanvasElement,haxe.extern.EitherType<Blob,haxe.extern.EitherType<ImageData,haxe.extern.EitherType<CanvasRenderingContext2D,ImageBitmap>>>>>>, aSx : Int, aSy : Int, aSw : Int, aSh : Int ) : Promise<ImageBitmap>;
  449. /** @throws DOMError */
  450. function btoa( btoa : String ) : String;
  451. /** @throws DOMError */
  452. function atob( atob : String ) : String;
  453. /** @throws DOMError */
  454. @:overload( function( handler : haxe.Constraints.Function, ?timeout : Int = 0, arguments : haxe.extern.Rest<Dynamic> ) : Int {} )
  455. function setTimeout( handler : String, ?timeout : Int = 0, unused : haxe.extern.Rest<Dynamic> ) : Int;
  456. function clearTimeout( ?handle : Int = 0 ) : Void;
  457. /** @throws DOMError */
  458. @:overload( function( handler : haxe.Constraints.Function, ?timeout : Int, arguments : haxe.extern.Rest<Dynamic> ) : Int {} )
  459. function setInterval( handler : String, ?timeout : Int, unused : haxe.extern.Rest<Dynamic> ) : Int;
  460. function clearInterval( ?handle : Int = 0 ) : Void;
  461. }