Browse Source

[js] move standard library types to js.lib (DON'T MERGE YET, let's discuss) (#7390)

* [js] move standard library types to js.lib

* fixed `js.lib.Date`

* fixed js.Date typedef

* removed js.Date and js.Map

* updated `js.*` references to `js.lib.*`
Dan Korostelev 6 years ago
parent
commit
88e5195369
52 changed files with 1088 additions and 858 deletions
  1. 2 2
      src/filters/jsExceptions.ml
  2. 3 3
      std/haxe/CallStack.hx
  3. 1 1
      std/haxe/Timer.hx
  4. 7 7
      std/js/Boot.hx
  5. 7 45
      std/js/Error.hx
  6. 1 28
      std/js/Function.hx
  7. 2 15
      std/js/JsIterator.hx
  8. 3 202
      std/js/Object.hx
  9. 4 85
      std/js/Promise.hx
  10. 2 23
      std/js/RegExp.hx
  11. 1 75
      std/js/Set.hx
  12. 1 38
      std/js/Symbol.hx
  13. 3 3
      std/js/_std/EReg.hx
  14. 3 3
      std/js/_std/Reflect.hx
  15. 3 3
      std/js/_std/Type.hx
  16. 21 19
      std/js/html/Animation.hx
  17. 2 0
      std/js/html/Cache.hx
  18. 7 5
      std/js/html/CacheStorage.hx
  19. 3 1
      std/js/html/Directory.hx
  20. 13 11
      std/js/html/FontFace.hx
  21. 7 5
      std/js/html/FontFaceSet.hx
  22. 4 2
      std/js/html/MediaDevices.hx
  23. 45 43
      std/js/html/MediaElement.hx
  24. 22 20
      std/js/html/MediaStreamTrack.hx
  25. 14 12
      std/js/html/Navigator.hx
  26. 3 1
      std/js/html/Permissions.hx
  27. 15 13
      std/js/html/Request.hx
  28. 13 11
      std/js/html/Response.hx
  29. 8 6
      std/js/html/ScreenOrientation.hx
  30. 10 8
      std/js/html/ServiceWorkerContainer.hx
  31. 13 11
      std/js/html/ServiceWorkerRegistration.hx
  32. 5 3
      std/js/html/StorageManager.hx
  33. 14 12
      std/js/html/SubtleCrypto.hx
  34. 81 79
      std/js/html/Window.hx
  35. 16 14
      std/js/html/eme/MediaKeySession.hx
  36. 6 4
      std/js/html/eme/MediaKeySystemAccess.hx
  37. 5 3
      std/js/html/eme/MediaKeys.hx
  38. 5 3
      std/js/html/push/PushManager.hx
  39. 8 6
      std/js/html/push/PushSubscription.hx
  40. 6 6
      std/js/lib/Date.hx
  41. 68 0
      std/js/lib/Error.hx
  42. 51 0
      std/js/lib/Function.hx
  43. 10 0
      std/js/lib/Iterator.hx
  44. 24 22
      std/js/lib/Map.hx
  45. 224 0
      std/js/lib/Object.hx
  46. 109 0
      std/js/lib/Promise.hx
  47. 46 0
      std/js/lib/RegExp.hx
  48. 99 0
      std/js/lib/Set.hx
  49. 61 0
      std/js/lib/Symbol.hx
  50. 4 2
      tests/server/src/Vfs.hx
  51. 2 2
      tests/unit/src/unit/issues/Issue3499.hx
  52. 1 1
      tests/unit/src/unit/issues/Issue4644.hx

+ 2 - 2
src/filters/jsExceptions.ml

@@ -58,7 +58,7 @@ let follow = Abstract.follow_with_abstracts
 
 
 let rec is_js_error c =
 let rec is_js_error c =
 	match c with
 	match c with
-	| { cl_path = ["js"],"Error" } -> true
+	| { cl_path = ["js";"lib"],"Error" } -> true
 	| { cl_super = Some (csup,_) } -> is_js_error csup
 	| { cl_super = Some (csup,_) } -> is_js_error csup
 	| _ -> false
 	| _ -> false
 
 
@@ -69,7 +69,7 @@ let find_cl com path =
 	) com.types
 	) com.types
 
 
 let init ctx =
 let init ctx =
-	let cJsError = find_cl ctx.com (["js"],"Error") in
+	let cJsError = find_cl ctx.com (["js";"lib"],"Error") in
 	let cHaxeError = find_cl ctx.com (["js";"_Boot"],"HaxeError") in
 	let cHaxeError = find_cl ctx.com (["js";"_Boot"],"HaxeError") in
 	let cStd = find_cl ctx.com ([],"Std") in
 	let cStd = find_cl ctx.com ([],"Std") in
 	let cBoot = find_cl ctx.com (["js"],"Boot") in
 	let cBoot = find_cl ctx.com (["js"],"Boot") in

+ 3 - 3
std/haxe/CallStack.hx

@@ -37,9 +37,9 @@ enum StackItem {
 **/
 **/
 class CallStack {
 class CallStack {
 	#if js
 	#if js
-	static var lastException:js.Error;
+	static var lastException:js.lib.Error;
 
 
-	static function getStack(e:js.Error):Array<StackItem> {
+	static function getStack(e:js.lib.Error):Array<StackItem> {
 		if (e == null) return [];
 		if (e == null) return [];
 		// https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
 		// https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
 		var oldValue = (untyped Error).prepareStackTrace;
 		var oldValue = (untyped Error).prepareStackTrace;
@@ -97,7 +97,7 @@ class CallStack {
 			return makeStack(s);
 			return makeStack(s);
 		#elseif js
 		#elseif js
 			try {
 			try {
-				throw new js.Error();
+				throw new js.lib.Error();
 			} catch( e : Dynamic ) {
 			} catch( e : Dynamic ) {
 				var a = getStack(js.Lib.getOriginalException());
 				var a = getStack(js.Lib.getOriginalException());
 				a.shift(); // remove Stack.callStack()
 				a.shift(); // remove Stack.callStack()

+ 1 - 1
std/haxe/Timer.hx

@@ -172,7 +172,7 @@ class Timer {
 		#elseif (neko || php)
 		#elseif (neko || php)
 			return Sys.time();
 			return Sys.time();
 		#elseif js
 		#elseif js
-			return js.Date.now() / 1000;
+			return js.lib.Date.now() / 1000;
 		#elseif cpp
 		#elseif cpp
 			return untyped __global__.__time_stamp();
 			return untyped __global__.__time_stamp();
 		#elseif python
 		#elseif python

+ 7 - 7
std/js/Boot.hx

@@ -23,22 +23,22 @@ package js;
 
 
 import js.Syntax; // import it here so it's always available in the compiler
 import js.Syntax; // import it here so it's always available in the compiler
 
 
-private class HaxeError extends js.Error {
+private class HaxeError extends js.lib.Error {
 	var val:Dynamic;
 	var val:Dynamic;
 
 
 	@:pure
 	@:pure
 	public function new(val:Dynamic) {
 	public function new(val:Dynamic) {
 		super();
 		super();
 		this.val = val;
 		this.val = val;
-		if ((cast js.Error).captureStackTrace) (cast js.Error).captureStackTrace(this, HaxeError);
+		if ((cast js.lib.Error).captureStackTrace) (cast js.lib.Error).captureStackTrace(this, HaxeError);
 	}
 	}
 
 
-	public static function wrap(val:Dynamic):js.Error {
-		return if (js.Syntax.instanceof(val, js.Error)) val else new HaxeError(val);
+	public static function wrap(val:Dynamic):js.lib.Error {
+		return if (js.Syntax.instanceof(val, js.lib.Error)) val else new HaxeError(val);
 	}
 	}
 
 
 	static function __init__() {
 	static function __init__() {
-		js.Object.defineProperty((cast HaxeError).prototype, "message", {get: () -> (cast String)(js.Lib.nativeThis.val)});
+		js.lib.Object.defineProperty((cast HaxeError).prototype, "message", {get: () -> (cast String)(js.Lib.nativeThis.val)});
 	}
 	}
 }
 }
 
 
@@ -161,7 +161,7 @@ class Boot {
 			return false;
 			return false;
 		if( cc == cl )
 		if( cc == cl )
 			return true;
 			return true;
-		if( js.Object.prototype.hasOwnProperty.call(cc, "__interfaces__") ) {
+		if( js.lib.Object.prototype.hasOwnProperty.call(cc, "__interfaces__") ) {
 			var intf : Dynamic = cc.__interfaces__;
 			var intf : Dynamic = cc.__interfaces__;
 			for( i in 0...intf.length ) {
 			for( i in 0...intf.length ) {
 				var i : Dynamic = intf[i];
 				var i : Dynamic = intf[i];
@@ -220,7 +220,7 @@ class Boot {
 		else throw "Cannot cast " +Std.string(o) + " to " +Std.string(t);
 		else throw "Cannot cast " +Std.string(o) + " to " +Std.string(t);
 	}
 	}
 
 
-	static var __toStr:js.Function;
+	static var __toStr:js.lib.Function;
 	static function __init__() {
 	static function __init__() {
 		Boot.__toStr = (cast {}).toString;
 		Boot.__toStr = (cast {}).toString;
 	}
 	}

+ 7 - 45
std/js/Error.hx

@@ -21,48 +21,10 @@
  */
  */
 package js;
 package js;
 
 
-@:native("Error")
-extern class Error
-{
-	var message : String;
-	var name : String;
-	var stack(default,null) : String;
-
-	function new(?message : String) : Void;
-}
-
-@:native("EvalError")
-extern class EvalError extends Error
-{
-	function new(?message : String) : Void;
-}
-
-@:native("RangeError")
-extern class RangeError extends Error
-{
-	function new(?message : String) : Void;
-}
-
-@:native("ReferenceError")
-extern class ReferenceError extends Error
-{
-	function new(?message : String) : Void;
-}
-
-@:native("SyntaxError")
-extern class SyntaxError extends Error
-{
-	function new(?message : String) : Void;
-}
-
-@:native("TypeError")
-extern class TypeError extends Error
-{
-	function new(?message : String) : Void;
-}
-
-@:native("URIError")
-extern class URIError extends Error
-{
-	function new(?message : String) : Void;
-}
+@:deprecated typedef Error = js.lib.Error;
+@:deprecated typedef EvalError = js.lib.Error.EvalError;
+@:deprecated typedef RangeError = js.lib.Error.RangeError;
+@:deprecated typedef ReferenceError = js.lib.Error.ReferenceError;
+@:deprecated typedef SyntaxError = js.lib.Error.SyntaxError;
+@:deprecated typedef TypeError = js.lib.Error.TypeError;
+@:deprecated typedef URIError = js.lib.Error.URIError;

+ 1 - 28
std/js/Function.hx

@@ -21,31 +21,4 @@
  */
  */
 package js;
 package js;
 
 
-import haxe.extern.Rest;
-
-@:native("Function")
-extern class Function {
-	/** Specifies the number of arguments expected by the function. **/
-	var length(default,never):Int;
-
-	/** The name of the function. **/
-	var name:String;
-
-	/** Creates a new Function object. **/
-	function new(arg:String, rest:Rest<String>);
-
-	/** Calls a function and sets its this to the provided value, arguments can be passed as an Array object. **/
-	function apply(thisArg:Dynamic, argsArray:Array<Dynamic>):Dynamic;
-
-	/** Calls (executes) a function and sets its this to the provided value, arguments can be passed as they are. **/
-	function call(thisArg:Dynamic, args:Rest<Dynamic>):Dynamic;
-
-	/**
-		Creates a new function which, when called, has its this set to the provided value,
-		with a given sequence of arguments preceding any provided when the new function was called.
-	**/
-	@:pure function bind(thisArg:Dynamic, args:Rest<Dynamic>):Function;
-
-	/** Returns a string representing the source code of the function. **/
-	@:pure function toString():String;
-}
+@:deprecated typedef Function = js.lib.Function;

+ 2 - 15
std/js/JsIterator.hx

@@ -1,17 +1,4 @@
 package js;
 package js;
 
 
-/**
-	JsIterator is prefixed with Js to avoid name clashes with standard 
-	Iterator structure.
-**/
-typedef JsIterator<T> = {
-	function next():JsIteratorStep<T>;
-}
-
-/**
-	Object returned by `JsIterator.next`.
-**/
-typedef JsIteratorStep<T> = {
-	done:Bool,
-	?value:T
-}
+@:deprecated typedef JsIterator<T> = js.lib.Iterator<T>;
+@:deprecated typedef JsIteratorStep<T> = js.lib.Iterator.JsIteratorStep<T>;

+ 3 - 202
std/js/Object.hx

@@ -21,205 +21,6 @@
  */
  */
 package js;
 package js;
 
 
-import haxe.extern.Rest;
-import haxe.DynamicAccess;
-
-/**
-	The `js.Object` constructor creates an object wrapper.
-	
-	Documentation [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
-**/
-@:native("Object")
-extern class Object {
-	/**
-		Copies the values of all enumerable own properties from one or more 
-		source objects to a target object.
-	**/
-	static function assign<T:{}>(target:T, sources:Rest<{}>):T;
-
-	/**
-		Creates a new object with the specified prototype object and properties.
-	**/
-	@:pure static function create<T>(proto:{}, ?propertiesObject:DynamicAccess<ObjectPropertyDescriptor>):T;
-
-	/**
-		Adds the named properties described by the given descriptors to an object.
-	**/
-	static function defineProperties<T:{}>(obj:T, props:DynamicAccess<ObjectPropertyDescriptor>):T;
-
-	/**
-		Adds the named property described by a given descriptor to an object.
-	**/
-	static function defineProperty<T:{}>(obj:T, prop:String, descriptor:ObjectPropertyDescriptor):T;
-
-	/**
-		Freezes an object: other code can't delete or change any properties.
-	**/
-	static function freeze<T:{}>(obj:T):T;
-
-	/**
-		Returns a property descriptor for a named property on an object.
-	**/
-	@:pure static function getOwnPropertyDescriptor(obj:{}, prop:String):Null<ObjectPropertyDescriptor>;
-
-	/**
-		Returns an array containing the names of all of the given object's own 
-		enumerable and non-enumerable properties.
-	**/
-	@:pure static function getOwnPropertyNames(obj:{}):Array<String>;
-
-	/**
-		Returns an array of all symbol properties found directly upon a given object.
-	**/
-	@:pure static function getOwnPropertySymbols(obj:{}):Array<Symbol>;
-
-	/**
-		Returns the prototype of the specified object.
-	**/
-	@:pure static function getPrototypeOf<TProto:{}>(obj:{}):Null<TProto>;
-
-	/**
-		Compares if two values are the same value. Equates all NaN values 
-		(which differs from both Abstract Equality Comparison and 
-		Strict Equality Comparison).
-	**/
-	@:pure static function is<T>(value1:T, value2:T):Bool;
-
-	/**
-		Determines if extending of an object is allowed.
-	**/
-	@:pure static function isExtensible(obj:{}):Bool;
-
-	/**
-		Determines if an object was frozen.
-	**/
-	@:pure static function isFrozen(obj:{}):Bool;
-
-	/**
-		Determines if an object is sealed.
-	**/
-	@:pure static function isSealed(obj:{}):Bool;
-
-	/**
-		Returns an array containing the names of all of the given object's own 
-		enumerable string properties.
-	**/
-	@:pure static function keys(obj:{}):Array<String>;
-
-	/**
-		Prevents any extensions of an object.
-	**/
-	static function preventExtensions<T:{}>(obj:T):T;
-
-	/**
-		Prevents other code from deleting properties of an object.
-	**/
-	static function seal<T:{}>(obj:T):T;
-
-	/**
-		Sets the prototype (i.e., the internal Prototype property).
-	**/
-	static function setPrototypeOf<T:{}>(obj:T, prototype:Null<{}>):T;
-
-	/**
-		Allows the addition of properties to all objects of type Object.
-	**/
-	static var prototype(default,never):ObjectPrototype;
-
-	/**
-		The Object constructor creates an object wrapper.
-	**/
-	@:pure function new(?value:Any);
-}
-
-/**
-	Type for 
-	@see <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object>
-**/
-typedef ObjectPrototype = {
-	/**
-		Returns a boolean indicating whether an object contains the specified 
-		property as a direct property of that object and not inherited through 
-		the prototype chain.
-	**/
-	var hasOwnProperty(default,never):Function;
-
-	/**
-		Returns a boolean indicating whether the object this method is called 
-		upon is in the prototype chain of the specified object.
-	**/
-	var isPrototypeOf(default,never):Function;
-
-	/**
-		Returns a boolean indicating if the internal enumerable attribute is set.
-	**/
-	var propertyIsEnumerable(default,never):Function;
-
-	/**
-		Calls `toString()`.
-	**/
-	var toLocaleString(default,never):Function;
-
-	/**
-		Returns a string representation of the object.
-	**/
-	var toString(default,never):Function;
-
-	/**
-		Returns the primitive value of the specified object.
-	**/
-	var valueOf(default,never):Function;
-}
-
-/**
-	@see <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty>
-**/
-typedef ObjectPropertyDescriptor = {
-	/**
-		`true` if and only if the type of this property descriptor may be 
-		changed and if the property may be deleted from the corresponding object.
-		
-		Defaults to `false`.
-	**/
-	var ?configurable:Bool;
-
-	/**
-		`true` if and only if this property shows up during enumeration of the
-		properties on the corresponding object.
-		
-		Defaults to `false`.
-	**/
-	var ?enumerable:Bool;
-
-	/**
-		The value associated with the property. 
-		Can be any valid JavaScript value (number, object, function, etc).
-	**/
-	var ?value:Any;
-
-	/**
-		`true` if and only if the value associated with the property may be 
-		changed with an assignment operator.
-		
-		Defaults to `false`.
-	**/
-	var ?writable:Bool;
-
-	/**
-		A function which serves as a getter for the property, or `undefined` if 
-		there is no getter. When the property is accessed, this function is 
-		called without arguments and with `this` set to the object through which 
-		the property is accessed (this may not be the object on which the 
-		property is defined due to inheritance). 
-		The return value will be used as the value of the property.
-	**/
-	var ?get:Void->Any;
-
-	/**
-		A function which serves as a setter for the property, or undefined if
-		there is no setter. When the property is assigned to, this function 
-		is called with one argument (the value being assigned to the property)
-		and with `this` set to the object through which the property is assigned.
-	**/
-	var ?set:Any->Void;
-}
+@:deprecated typedef Object = js.lib.Object;
+@:deprecated typedef ObjectPrototype = js.lib.Object.ObjectPrototype;
+@:deprecated typedef ObjectPropertyDescriptor = js.lib.Object.ObjectPropertyDescriptor;

+ 4 - 85
std/js/Promise.hx

@@ -22,88 +22,7 @@
 
 
 package js;
 package js;
 
 
-import haxe.extern.EitherType;
-
-/**
-	The Promise object represents the eventual completion (or failure) of an
-	asynchronous operation and its resulting value.
-
-	Documentation [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
-**/
-@:native("Promise")
-extern class Promise<T>
-{
-	/**
-		Returns a Promise object that is resolved with the given value. If the
-		value is Thenable, the returned promise will "follow" that
-		thenable, adopting its eventual state;
-		otherwise the returned promise will be fulfilled with the value.
-		Generally, when it's unknown when value is a promise or not,
-		use `Promise.resolve(value)` instead and work with the return value as
-		a promise.
-	**/
-	@:overload(function<T>(?value : T) : Promise<T> {})
-	static function resolve<T>( thenable : Thenable<T> ) : Promise<T>;
-
-	/**
-		Returns a Promise object that is rejected with the given reason.
-	**/
-	static function reject<T>( ?reason : Dynamic ) : Promise<T>;
-
-	/**
-		Returns a promise that either fulfills when all of the promises in the
-		iterable argument have fulfilled or rejects as soon as one of the
-		promises in the iterable argument rejects. If the returned promise
-		fulfills, it is fulfilled with an array of the values from the
-		fulfilled promises in the same order as defined in the iterable.
-		If the returned promise rejects, it is rejected with the reason from
-		the first promise in the iterable that rejected. This method can be
-		useful for aggregating results of multiple promises.
-	**/
-	static function all( iterable : Array<Dynamic> ) : Promise<Array<Dynamic>>;
-
-	/**
-		Returns a promise that fulfills or rejects as soon as one of the
-		promises in the iterable fulfills or rejects, with the value or reason
-		from that promise.
-	**/
-	static function race( iterable : Array<Dynamic> ) : Promise<Dynamic>;
-
-	/** @throws DOMError */
-	function new( init : (resolve : (value : T) -> Void, reject: (reason : Dynamic) -> Void) -> Void ) : Void;
-
-	/**
-		Appends fulfillment and rejection handlers to the promise and returns a
-		new promise resolving to the return value of the called handler, or to
-		its original settled value if the promise was not handled
-		(i.e. if the relevant handler onFulfilled or onRejected is not a function).
-	**/
-	function then<TOut>( onFulfilled : Null<PromiseHandler<T, TOut>>, ?onRejected : PromiseHandler<Dynamic, TOut> ) : Promise<TOut>;
-
-	/**
-		Appends a rejection handler callback to the promise, and returns a new
-		promise resolving to the return value of the callback if it is called,
-		or to its original fulfillment value if the promise is instead fulfilled.
-	**/
-	@:native("catch")
-	function catchError<TOut>( onRejected : PromiseHandler<Dynamic, TOut> ) : Promise<TOut>;
-}
-
-/**
-	Handler type for the Promise object.
-**/
-abstract PromiseHandler<T,TOut>(T->Dynamic) // T->Dynamic, so the compiler always knows the type of the argument and can infer it for then/catch callbacks
-	from T->TOut // order is important, because Promise<TOut> return must have priority 
-	from T->Thenable<TOut> // although the checking order seems to be reversed at the moment, see https://github.com/HaxeFoundation/haxe/issues/7656
-	from T->Promise<TOut> // support Promise explicitly as it doesn't work transitively through Thenable at the moment
-{}
-
-/**
-	A value with a `then` method.
-**/
-@:forward
-abstract Thenable<T>(ThenableStruct<T>) from ThenableStruct<T> {} // abstract wrapping prevents compiler hanging, see https://github.com/HaxeFoundation/haxe/issues/5785
-
-typedef ThenableStruct<T> = {
-	function then<TOut>( onFulfilled : Null<PromiseHandler<T, TOut>>, ?onRejected : PromiseHandler<Dynamic, TOut> ) : Thenable<TOut>;
-}
+@:deprecated typedef Promise<T> = js.lib.Promise<T>;
+@:deprecated typedef PromiseHandler<T, TOut> = js.lib.Promise.PromiseHandler<T, TOut>;
+@:deprecated typedef Thenable<T> = js.lib.Promise.Thenable<T>;
+@:deprecated typedef ThenableStruct<T> = js.lib.Promise.ThenableStruct<T>;

+ 2 - 23
std/js/RegExp.hx

@@ -21,26 +21,5 @@
  */
  */
  package js;
  package js;
 
 
-/**
-	Native JavaScript regular expressions.
-
-	For cross-platform regular expressions, use Haxe `EReg` class or
-	[regexp literals](https://haxe.org/manual/std-regex.html).
-**/
-@:native("RegExp")
-extern class RegExp {
-	var global(default,null):Bool;
-	var ignoreCase(default,null):Bool;
-	var multiline(default,null):Bool;
-	var source(default,null):String;
-	var lastIndex:Int;
-	function new(pattern:String, ?flags:String);
-	function exec(str:String):Null<RegExpMatch>;
-	function test(str:String):Bool;
-	function toString():String;
-}
-
-extern class RegExpMatch extends Array<String> {
-	var index:Int;
-	var input:String;
-}
+@:deprecated typedef RegExp = js.lib.RegExp;
+@:deprecated typedef RegExpMatch = js.lib.RegExp.RegExpMatch;

+ 1 - 75
std/js/Set.hx

@@ -21,78 +21,4 @@
  */
  */
 package js;
 package js;
 
 
-import js.Map.MapEntry;
-
-/**
-	The `js.Set` object lets you store unique values of any type, whether 
-	primitive values or object references.
-	
-	Documentation [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
-**/
-@:native("Set")
-extern class Set<T> {
-	/** 
-		The number of values in the `js.Set` object. 
-	**/
-	var size(default,null):Int;
-
-	/**
-		If an iterable object is passed, all of its elements will be added to 
-		the new `js.Set`. 
-	**/
-	@:pure function new(?iterable:Any);
-
-	/**
-		Returns a boolean asserting whether an element is present with the given
-		value in the `js.Set` object or not.
-	**/
-	@:pure function has(value:T):Bool;
-
-	/**
-		Appends a new element with the given value to the `js.Set` object. 
-		Returns the `js.Set` object.
-	**/
-	function add(value:T):Set<T>;
-
-	/**
-		Removes the element associated to the value and returns the value that
-		`has(value)` would have previously returned. 
-		`has(value)` will return `false` afterwards.
-	**/
-	function delete(value:T):Bool;
-
-	/**
-		Removes all elements from the `js.Set` object.
-	**/
-	function clear():Void;
-
-	/**
-		Calls `callback` once for each key-value pair present in the `js.Set` 
-		object, in insertion order. 
-		
-		If a `thisArg` parameter is provided to forEach, it will be used as the
-		`this` value for each callback.
-	**/
-	function forEach(callback:(value:T, key:T, set:Set<T>)->Void, ?thisArg:Any):Void;
-
-	/**
-		Returns a new `JsIterator` object that contains the keys for each element 
-		in the `js.Set` object in insertion order.
-	**/
-	function keys():JsIterator<T>;
-
-	/**
-		Returns a new `JsIterator` object that contains the values for each 
-		element in the `js.Set` object in insertion order.
-	**/
-	function values():JsIterator<T>;
-
-	/**
-		Returns a new `JsIterator` object that contains an array of 
-		`[value, value]` for each element in the `js.Set` object, in insertion 
-		order. 
-		This is kept similar to the `js.Map` object, so that each entry has the 
-		same value for its key and value here.
-	**/
-	function entries():JsIterator<MapEntry<T,T>>;
-}
+@:deprecated typedef Set<T> = js.lib.Set<T>;

+ 1 - 38
std/js/Symbol.hx

@@ -21,41 +21,4 @@
  */
  */
 package js;
 package js;
 
 
-@:native("Symbol")
-extern class Symbol {
-	/**
-		To create a new primitive symbol, you write `new Symbol()` with an optional string as its `description`.
-
-		NOTE: Unlike plain JavaScript, in Haxe `new Symbol()` syntax is used, however `Symbol(...)` expression
-		will be generated as required by JavaScript specification.
-	**/
-	@:pure @:selfCall function new(?description:String);
-
-	/**
-		Searches for existing symbols with the given key and returns it if found.
-		Otherwise a new symbol gets created in the global symbol registry with this key.
-	**/
-	@:native("for") static function for_(key:String):Symbol;
-
-	/**
-		Retrieves a shared symbol key from the global symbol registry for the given symbol.
-	**/
-	@:pure static function keyFor(sym:Symbol):Null<String>;
-
-	/**
-		Returns a string containing the description of the Symbol.
-	**/
-	@:pure function toString():String;
-
-	/**
-		A method returning the default iterator for an object.
-	**/
-	static var iterator(default,null):Symbol;
-
-	/**
-		Retrieve symbol from a given `object`.
-
-		NOTE: This is a Haxe-specific method that generates `object[symbol]` expression.
-	**/
-	inline function ofObject<T>(object:{}):Null<T> return (cast object)[cast this];
-}
+@:deprecated typedef Symbol = js.lib.Symbol;

+ 3 - 3
std/js/_std/EReg.hx

@@ -112,11 +112,11 @@
 	public static inline function escape( s : String ) : String {
 	public static inline function escape( s : String ) : String {
 		return (cast s).replace(escapeRe, "\\$&");
 		return (cast s).replace(escapeRe, "\\$&");
 	}
 	}
-	static var escapeRe = new js.RegExp("[.*+?^${}()|[\\]\\\\]", "g");
+	static var escapeRe = new js.lib.RegExp("[.*+?^${}()|[\\]\\\\]", "g");
 }
 }
 
 
 @:native("RegExp")
 @:native("RegExp")
-private extern class HaxeRegExp extends js.RegExp {
-	var m:js.RegExp.RegExpMatch;
+private extern class HaxeRegExp extends js.lib.RegExp {
+	var m:js.lib.RegExp.RegExpMatch;
 	var s:String;
 	var s:String;
 }
 }

+ 3 - 3
std/js/_std/Reflect.hx

@@ -23,7 +23,7 @@
 
 
 	@:pure
 	@:pure
 	public inline static function hasField( o : Dynamic, field : String ) : Bool {
 	public inline static function hasField( o : Dynamic, field : String ) : Bool {
-		return js.Object.prototype.hasOwnProperty.call(o, field);
+		return js.lib.Object.prototype.hasOwnProperty.call(o, field);
 	}
 	}
 
 
 	@:pure
 	@:pure
@@ -46,13 +46,13 @@
 	}
 	}
 
 
 	public inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array<Dynamic> ) : Dynamic {
 	public inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array<Dynamic> ) : Dynamic {
-		return (cast func : js.Function).apply(o,args);
+		return (cast func : js.lib.Function).apply(o,args);
 	}
 	}
 
 
 	public static function fields( o : Dynamic ) : Array<String> {
 	public static function fields( o : Dynamic ) : Array<String> {
 		var a = [];
 		var a = [];
 		if (o != null) untyped {
 		if (o != null) untyped {
-			var hasOwnProperty = js.Object.prototype.hasOwnProperty;
+			var hasOwnProperty = js.lib.Object.prototype.hasOwnProperty;
 			__js__("for( var f in o ) {");
 			__js__("for( var f in o ) {");
 			if( f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o, f) ) a.push(f);
 			if( f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o, f) ) a.push(f);
 			__js__("}");
 			__js__("}");

+ 3 - 3
std/js/_std/Type.hx

@@ -138,7 +138,7 @@ enum ValueType {
 		}
 		}
 
 
 	public static inline function createEmptyInstance<T>(cl:Class<T>):T {
 	public static inline function createEmptyInstance<T>(cl:Class<T>):T {
-		return js.Object.create((cast cl).prototype);
+		return js.lib.Object.create((cast cl).prototype);
 	}
 	}
 	#end
 	#end
 	public static function createEnum<T>(e:Enum<T>, constr:String, ?params:Array<Dynamic>):T {
 	public static function createEnum<T>(e:Enum<T>, constr:String, ?params:Array<Dynamic>):T {
@@ -166,7 +166,7 @@ enum ValueType {
 	public static function getInstanceFields(c:Class<Dynamic>):Array<String> {
 	public static function getInstanceFields(c:Class<Dynamic>):Array<String> {
 		var result = [];
 		var result = [];
 		while (c != null) {
 		while (c != null) {
-			for (name in js.Object.getOwnPropertyNames((cast c).prototype)) {
+			for (name in js.lib.Object.getOwnPropertyNames((cast c).prototype)) {
 				switch name {
 				switch name {
 					case "constructor" | "__class__" | "__properties__":
 					case "constructor" | "__class__" | "__properties__":
 					// skip special names
 					// skip special names
@@ -181,7 +181,7 @@ enum ValueType {
 	}
 	}
 
 
 	public static function getClassFields(c:Class<Dynamic>):Array<String> {
 	public static function getClassFields(c:Class<Dynamic>):Array<String> {
-		var a = js.Object.getOwnPropertyNames(cast c);
+		var a = js.lib.Object.getOwnPropertyNames(cast c);
 		a.remove("__id__");
 		a.remove("__id__");
 		a.remove("hx__closures__");
 		a.remove("hx__closures__");
 		a.remove("__name__");
 		a.remove("__name__");

+ 21 - 19
std/js/html/Animation.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `Animation` interface of the Web Animations API represents a single animation player and provides playback controls and a timeline for an animation node or source.
 	The `Animation` interface of the Web Animations API represents a single animation player and provides playback controls and a timeline for an animation node or source.
 
 
@@ -33,98 +35,98 @@ package js.html;
 **/
 **/
 @:native("Animation")
 @:native("Animation")
 extern class Animation extends EventTarget {
 extern class Animation extends EventTarget {
-	
+
 	/**
 	/**
 		Gets and sets the `String` used to identify the animation.
 		Gets and sets the `String` used to identify the animation.
 	**/
 	**/
 	var id : String;
 	var id : String;
-	
+
 	/**
 	/**
 		Gets and sets the `AnimationEffectReadOnly` associated with this animation. This will usually be a `KeyframeEffect` object.
 		Gets and sets the `AnimationEffectReadOnly` associated with this animation. This will usually be a `KeyframeEffect` object.
 	**/
 	**/
 	var effect : AnimationEffect;
 	var effect : AnimationEffect;
-	
+
 	/**
 	/**
 		Gets or sets the `AnimationTimeline` associated with this animation.
 		Gets or sets the `AnimationTimeline` associated with this animation.
 	**/
 	**/
 	var timeline : AnimationTimeline;
 	var timeline : AnimationTimeline;
-	
+
 	/**
 	/**
 		Gets or sets the scheduled time when an animation's playback should begin.
 		Gets or sets the scheduled time when an animation's playback should begin.
 	**/
 	**/
 	var startTime : Float;
 	var startTime : Float;
-	
+
 	/**
 	/**
 		The current time value of the animation in milliseconds, whether running or paused. If the animation lacks a `AnimationTimeline`, is inactive or hasn't been played yet, its value is `null`.
 		The current time value of the animation in milliseconds, whether running or paused. If the animation lacks a `AnimationTimeline`, is inactive or hasn't been played yet, its value is `null`.
 	**/
 	**/
 	var currentTime : Float;
 	var currentTime : Float;
-	
+
 	/**
 	/**
 		Gets or sets the playback rate of the animation.
 		Gets or sets the playback rate of the animation.
 	**/
 	**/
 	var playbackRate : Float;
 	var playbackRate : Float;
-	
+
 	/**
 	/**
 		Returns an enumerated value describing the playback state of an animation.
 		Returns an enumerated value describing the playback state of an animation.
 	**/
 	**/
 	var playState(default,null) : AnimationPlayState;
 	var playState(default,null) : AnimationPlayState;
-	
+
 	/**
 	/**
 		Indicates whether the animation is currently waiting for an asynchronous operation such as initiating playback or pausing a running animation.
 		Indicates whether the animation is currently waiting for an asynchronous operation such as initiating playback or pausing a running animation.
 	**/
 	**/
 	var pending(default,null) : Bool;
 	var pending(default,null) : Bool;
-	
+
 	/**
 	/**
 		Returns the current ready Promise for this animation.
 		Returns the current ready Promise for this animation.
 	**/
 	**/
 	var ready(default,null) : Promise<Animation>;
 	var ready(default,null) : Promise<Animation>;
-	
+
 	/**
 	/**
 		Returns the current finished Promise for this animation.
 		Returns the current finished Promise for this animation.
 	**/
 	**/
 	var finished(default,null) : Promise<Animation>;
 	var finished(default,null) : Promise<Animation>;
-	
+
 	/**
 	/**
 		Gets and sets the event handler for the `finish` event.
 		Gets and sets the event handler for the `finish` event.
 	**/
 	**/
 	var onfinish : haxe.Constraints.Function;
 	var onfinish : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		Gets and sets the event handler for the `cancel` event.
 		Gets and sets the event handler for the `cancel` event.
 	**/
 	**/
 	var oncancel : haxe.Constraints.Function;
 	var oncancel : haxe.Constraints.Function;
-	
+
 	/** @throws DOMError */
 	/** @throws DOMError */
 	function new( ?effect : AnimationEffect, ?timeline : AnimationTimeline ) : Void;
 	function new( ?effect : AnimationEffect, ?timeline : AnimationTimeline ) : Void;
-	
+
 	/**
 	/**
 		Clears all `KeyframeEffect` caused by this animation and aborts its playback.
 		Clears all `KeyframeEffect` caused by this animation and aborts its playback.
 	**/
 	**/
 	function cancel() : Void;
 	function cancel() : Void;
-	
+
 	/**
 	/**
 		Seeks either end of an animation, depending on whether the animation is playing or reversing.
 		Seeks either end of an animation, depending on whether the animation is playing or reversing.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function finish() : Void;
 	function finish() : Void;
-	
+
 	/**
 	/**
 		Starts or resumes playing of an animation, or begins the animation again if it previously finished.
 		Starts or resumes playing of an animation, or begins the animation again if it previously finished.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function play() : Void;
 	function play() : Void;
-	
+
 	/**
 	/**
 		Suspends playing of an animation.
 		Suspends playing of an animation.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function pause() : Void;
 	function pause() : Void;
-	
+
 	/**
 	/**
 		Sets the speed of an animation after first synchronizing its playback position.
 		Sets the speed of an animation after first synchronizing its playback position.
 	**/
 	**/
 	function updatePlaybackRate( playbackRate : Float ) : Void;
 	function updatePlaybackRate( playbackRate : Float ) : Void;
-	
+
 	/**
 	/**
 		Reverses playback direction, stopping at the start of the animation. If the animation is finished or unplayed, it will play from end to beginning.
 		Reverses playback direction, stopping at the start of the animation. If the animation is finished or unplayed, it will play from end to beginning.
 		@throws DOMError
 		@throws DOMError

+ 2 - 0
std/js/html/Cache.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `Cache` interface provides a storage mechanism for `Request` / `Response` object pairs that are cached, for example as part of the `ServiceWorker` life cycle. Note that the `Cache` interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec.
 	The `Cache` interface provides a storage mechanism for `Request` / `Response` object pairs that are cached, for example as part of the `ServiceWorker` life cycle. Note that the `Cache` interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec.
 
 

+ 7 - 5
std/js/html/CacheStorage.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `CacheStorage` interface represents the storage for `Cache` objects.
 	The `CacheStorage` interface represents the storage for `Cache` objects.
 
 
@@ -35,28 +37,28 @@ package js.html;
 extern class CacheStorage {
 extern class CacheStorage {
 	/** @throws DOMError */
 	/** @throws DOMError */
 	function new( namespace : CacheStorageNamespace, principal : Dynamic/*MISSING Principal*/ ) : Void;
 	function new( namespace : CacheStorageNamespace, principal : Dynamic/*MISSING Principal*/ ) : Void;
-	
+
 	/**
 	/**
 		Checks if a given `Request` is a key in any of the `Cache` objects that the `CacheStorage` object tracks, and returns a `Promise` that resolves to that match.
 		Checks if a given `Request` is a key in any of the `Cache` objects that the `CacheStorage` object tracks, and returns a `Promise` that resolves to that match.
 	**/
 	**/
 	@:overload( function( request : String, ?options : CacheQueryOptions) : Promise<Response> {} )
 	@:overload( function( request : String, ?options : CacheQueryOptions) : Promise<Response> {} )
 	function match( request : Request, ?options : CacheQueryOptions ) : Promise<Response>;
 	function match( request : Request, ?options : CacheQueryOptions ) : Promise<Response>;
-	
+
 	/**
 	/**
 		Returns a `Promise` that resolves to `true` if a `Cache` object matching the `cacheName` exists.
 		Returns a `Promise` that resolves to `true` if a `Cache` object matching the `cacheName` exists.
 	**/
 	**/
 	function has( cacheName : String ) : Promise<Bool>;
 	function has( cacheName : String ) : Promise<Bool>;
-	
+
 	/**
 	/**
 		Returns a `Promise` that resolves to the `Cache` object matching the `cacheName` (a new cache is created if it doesn't already exist.)
 		Returns a `Promise` that resolves to the `Cache` object matching the `cacheName` (a new cache is created if it doesn't already exist.)
 	**/
 	**/
 	function open( cacheName : String ) : Promise<Cache>;
 	function open( cacheName : String ) : Promise<Cache>;
-	
+
 	/**
 	/**
 		Finds the `Cache` object matching the `cacheName`, and if found, deletes the `Cache` object and returns a `Promise` that resolves to `true`. If no `Cache` object is found, it returns `false`.
 		Finds the `Cache` object matching the `cacheName`, and if found, deletes the `Cache` object and returns a `Promise` that resolves to `true`. If no `Cache` object is found, it returns `false`.
 	**/
 	**/
 	function delete( cacheName : String ) : Promise<Bool>;
 	function delete( cacheName : String ) : Promise<Bool>;
-	
+
 	/**
 	/**
 		Returns a `Promise` that will resolve with an array containing strings corresponding to all of the named `Cache` objects tracked by the `CacheStorage`. Use this method to iterate over a list of all the `Cache` objects.
 		Returns a `Promise` that will resolve with an array containing strings corresponding to all of the named `Cache` objects tracked by the `CacheStorage`. Use this method to iterate over a list of all the `Cache` objects.
 	**/
 	**/

+ 3 - 1
std/js/html/Directory.hx

@@ -24,11 +24,13 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 @:native("Directory")
 @:native("Directory")
 extern class Directory {
 extern class Directory {
 	var name(default,null) : String;
 	var name(default,null) : String;
 	var path(default,null) : String;
 	var path(default,null) : String;
-	
+
 	/** @throws DOMError */
 	/** @throws DOMError */
 	function new( path : String ) : Void;
 	function new( path : String ) : Void;
 	/** @throws DOMError */
 	/** @throws DOMError */

+ 13 - 11
std/js/html/FontFace.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `FontFace` interface represents a single usable font face. It allows control of the source of the font face, being a URL to an external resource, or a buffer; it also allows control of when the font face is loaded and its current status.
 	The `FontFace` interface represents a single usable font face. It allows control of the source of the font face, being a URL to an external resource, or a buffer; it also allows control of when the font face is loaded and its current status.
 
 
@@ -33,57 +35,57 @@ package js.html;
 **/
 **/
 @:native("FontFace")
 @:native("FontFace")
 extern class FontFace {
 extern class FontFace {
-	
+
 	/**
 	/**
 		Is a `CSSOMString` that contains the family of the font. It is equivalent to the `@font-face/font-family` descriptor.
 		Is a `CSSOMString` that contains the family of the font. It is equivalent to the `@font-face/font-family` descriptor.
 	**/
 	**/
 	var family : String;
 	var family : String;
-	
+
 	/**
 	/**
 		Is a `CSSOMString` that contains the style of the font. It is equivalent to the `@font-face/font-style` descriptor.
 		Is a `CSSOMString` that contains the style of the font. It is equivalent to the `@font-face/font-style` descriptor.
 	**/
 	**/
 	var style : String;
 	var style : String;
-	
+
 	/**
 	/**
 		Is a `CSSOMString` that contains the weight of the font. It is equivalent to the `@font-face/font-weight` descriptor.
 		Is a `CSSOMString` that contains the weight of the font. It is equivalent to the `@font-face/font-weight` descriptor.
 	**/
 	**/
 	var weight : String;
 	var weight : String;
-	
+
 	/**
 	/**
 		Is a `CSSOMString` that contains how the font stretches. It is equivalent to the `@font-face/font-stretch` descriptor.
 		Is a `CSSOMString` that contains how the font stretches. It is equivalent to the `@font-face/font-stretch` descriptor.
 	**/
 	**/
 	var stretch : String;
 	var stretch : String;
-	
+
 	/**
 	/**
 		Is a `CSSOMString` that contains the range of code encompassed the font. It is equivalent to the `@font-face/unicode-range` descriptor.
 		Is a `CSSOMString` that contains the range of code encompassed the font. It is equivalent to the `@font-face/unicode-range` descriptor.
 	**/
 	**/
 	var unicodeRange : String;
 	var unicodeRange : String;
-	
+
 	/**
 	/**
 		Is a `CSSOMString` that contains the variant of the font. It is equivalent to the `@font-face/font-variant` descriptor.
 		Is a `CSSOMString` that contains the variant of the font. It is equivalent to the `@font-face/font-variant` descriptor.
 	**/
 	**/
 	var variant : String;
 	var variant : String;
-	
+
 	/**
 	/**
 		Is a `CSSOMString` that contains the features of the font. It is equivalent to the `@font-face/font-feature-settings`descriptor.
 		Is a `CSSOMString` that contains the features of the font. It is equivalent to the `@font-face/font-feature-settings`descriptor.
 	**/
 	**/
 	var featureSettings : String;
 	var featureSettings : String;
-	
+
 	/**
 	/**
 		Returns an enumerated value indicating the status of the font. It can be one of the following: `"unloaded"`, `"loading"`, `"loaded"`, or `"error"`.
 		Returns an enumerated value indicating the status of the font. It can be one of the following: `"unloaded"`, `"loading"`, `"loaded"`, or `"error"`.
 	**/
 	**/
 	var status(default,null) : FontFaceLoadStatus;
 	var status(default,null) : FontFaceLoadStatus;
-	
+
 	/**
 	/**
 		Returns a `Promise` to a `FontFace` that fulfills when the font is completely loaded and rejects when an error happens.
 		Returns a `Promise` to a `FontFace` that fulfills when the font is completely loaded and rejects when an error happens.
 	**/
 	**/
 	var loaded(default,null) : Promise<FontFace>;
 	var loaded(default,null) : Promise<FontFace>;
-	
+
 	/** @throws DOMError */
 	/** @throws DOMError */
 	@:overload( function( family : String, source : js.lib.ArrayBuffer, ?descriptors : FontFaceDescriptors) : FontFace {} )
 	@:overload( function( family : String, source : js.lib.ArrayBuffer, ?descriptors : FontFaceDescriptors) : FontFace {} )
 	@:overload( function( family : String, source : js.lib.ArrayBufferView, ?descriptors : FontFaceDescriptors) : FontFace {} )
 	@:overload( function( family : String, source : js.lib.ArrayBufferView, ?descriptors : FontFaceDescriptors) : FontFace {} )
 	function new( family : String, source : String, ?descriptors : FontFaceDescriptors ) : Void;
 	function new( family : String, source : String, ?descriptors : FontFaceDescriptors ) : Void;
-	
+
 	/**
 	/**
 		Loads the font, returning a `Promise` to a `FontFace` that fulfills when the font is completely loaded and rejects when an error happens.
 		Loads the font, returning a `Promise` to a `FontFace` that fulfills when the font is completely loaded and rejects when an error happens.
 		@throws DOMError
 		@throws DOMError

+ 7 - 5
std/js/html/FontFaceSet.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `FontFaceSet` interface of the CSS Font Loading API manages the loading of font-faces and querying of their download status.
 	The `FontFaceSet` interface of the CSS Font Loading API manages the loading of font-faces and querying of their download status.
 
 
@@ -34,28 +36,28 @@ package js.html;
 @:native("FontFaceSet")
 @:native("FontFaceSet")
 extern class FontFaceSet extends EventTarget {
 extern class FontFaceSet extends EventTarget {
 	var size(default,null) : Int;
 	var size(default,null) : Int;
-	
+
 	/**
 	/**
 		An `EventListener` called whenever an event of type `loading` is fired, indicating a font-face set has started loading.
 		An `EventListener` called whenever an event of type `loading` is fired, indicating a font-face set has started loading.
 	**/
 	**/
 	var onloading : haxe.Constraints.Function;
 	var onloading : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		An `EventListener` called whenever an event of type `loadingdone` is fired, indicating that a font face set has finished loading.
 		An `EventListener` called whenever an event of type `loadingdone` is fired, indicating that a font face set has finished loading.
 	**/
 	**/
 	var onloadingdone : haxe.Constraints.Function;
 	var onloadingdone : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		An `EventListener` called whenever an event of type `loadingerror` is fired, indicating that an error occurred whilst loading a font-face set.
 		An `EventListener` called whenever an event of type `loadingerror` is fired, indicating that an error occurred whilst loading a font-face set.
 	**/
 	**/
 	var onloadingerror : haxe.Constraints.Function;
 	var onloadingerror : haxe.Constraints.Function;
 	var ready(default,null) : Promise<Void>;
 	var ready(default,null) : Promise<Void>;
-	
+
 	/**
 	/**
 		Indicates the font-face's loading status. It will be one of `'loading'` or `'loaded'`.
 		Indicates the font-face's loading status. It will be one of `'loading'` or `'loaded'`.
 	**/
 	**/
 	var status(default,null) : FontFaceSetLoadStatus;
 	var status(default,null) : FontFaceSetLoadStatus;
-	
+
 	/** @throws DOMError */
 	/** @throws DOMError */
 	function add( font : FontFace ) : Void;
 	function add( font : FontFace ) : Void;
 	function has( font : FontFace ) : Bool;
 	function has( font : FontFace ) : Bool;

+ 4 - 2
std/js/html/MediaDevices.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `MediaDevices` interface provides access to connected media input devices like cameras and microphones, as well as screen sharing. In essence, it lets you obtain access to any hardware source of media data.
 	The `MediaDevices` interface provides access to connected media input devices like cameras and microphones, as well as screen sharing. In essence, it lets you obtain access to any hardware source of media data.
 
 
@@ -33,12 +35,12 @@ package js.html;
 **/
 **/
 @:native("MediaDevices")
 @:native("MediaDevices")
 extern class MediaDevices extends EventTarget {
 extern class MediaDevices extends EventTarget {
-	
+
 	/**
 	/**
 		The event handler for the `devicechange` event. This event is delivered to the `MediaDevices` object when a media input or output device is attached to or removed from the user's computer.
 		The event handler for the `devicechange` event. This event is delivered to the `MediaDevices` object when a media input or output device is attached to or removed from the user's computer.
 	**/
 	**/
 	var ondevicechange : haxe.Constraints.Function;
 	var ondevicechange : haxe.Constraints.Function;
-	
+
 	function getSupportedConstraints() : MediaTrackSupportedConstraints;
 	function getSupportedConstraints() : MediaTrackSupportedConstraints;
 	/** @throws DOMError */
 	/** @throws DOMError */
 	function enumerateDevices() : Promise<Array<MediaDeviceInfo>>;
 	function enumerateDevices() : Promise<Array<MediaDeviceInfo>>;

+ 45 - 43
std/js/html/MediaElement.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `HTMLMediaElement` interface adds to `HTMLElement` the properties and methods needed to support basic media-related capabilities that are common to audio and video.
 	The `HTMLMediaElement` interface adds to `HTMLElement` the properties and methods needed to support basic media-related capabilities that are common to audio and video.
 
 
@@ -42,198 +44,198 @@ extern class MediaElement extends Element {
 	static inline var HAVE_CURRENT_DATA : Int = 2;
 	static inline var HAVE_CURRENT_DATA : Int = 2;
 	static inline var HAVE_FUTURE_DATA : Int = 3;
 	static inline var HAVE_FUTURE_DATA : Int = 3;
 	static inline var HAVE_ENOUGH_DATA : Int = 4;
 	static inline var HAVE_ENOUGH_DATA : Int = 4;
-	
-	
+
+
 	/**
 	/**
 		Returns a `MediaError` object for the most recent error, or `null` if there has not been an error.
 		Returns a `MediaError` object for the most recent error, or `null` if there has not been an error.
 	**/
 	**/
 	var error(default,null) : MediaError;
 	var error(default,null) : MediaError;
-	
+
 	/**
 	/**
 		Is a `DOMString` that reflects the `src` HTML attribute, which contains the URL of a media resource to use.
 		Is a `DOMString` that reflects the `src` HTML attribute, which contains the URL of a media resource to use.
 	**/
 	**/
 	var src : String;
 	var src : String;
-	
+
 	/**
 	/**
 		Returns a `DOMString` with the absolute URL of the chosen media resource.
 		Returns a `DOMString` with the absolute URL of the chosen media resource.
 	**/
 	**/
 	var currentSrc(default,null) : String;
 	var currentSrc(default,null) : String;
-	
+
 	/**
 	/**
 		Is a `DOMString` indicating the CORS setting for this media element.
 		Is a `DOMString` indicating the CORS setting for this media element.
 	**/
 	**/
 	var crossOrigin : String;
 	var crossOrigin : String;
-	
+
 	/**
 	/**
 		Returns a `unsigned short` (enumeration) indicating the current state of fetching the media over the network.
 		Returns a `unsigned short` (enumeration) indicating the current state of fetching the media over the network.
 	**/
 	**/
 	var networkState(default,null) : Int;
 	var networkState(default,null) : Int;
-	
+
 	/**
 	/**
 		Is a `DOMString` that reflects the `preload` HTML attribute, indicating what data should be preloaded, if any. Possible values are: `none`, `metadata`, `auto`.
 		Is a `DOMString` that reflects the `preload` HTML attribute, indicating what data should be preloaded, if any. Possible values are: `none`, `metadata`, `auto`.
 	**/
 	**/
 	var preload : String;
 	var preload : String;
-	
+
 	/**
 	/**
 		Returns a `TimeRanges` object that indicates the ranges of the media source that the browser has buffered (if any) at the moment the `buffered` property is accessed.
 		Returns a `TimeRanges` object that indicates the ranges of the media source that the browser has buffered (if any) at the moment the `buffered` property is accessed.
 	**/
 	**/
 	var buffered(default,null) : TimeRanges;
 	var buffered(default,null) : TimeRanges;
-	
+
 	/**
 	/**
 		Returns a `unsigned short` (enumeration) indicating the readiness state of the media.
 		Returns a `unsigned short` (enumeration) indicating the readiness state of the media.
 	**/
 	**/
 	var readyState(default,null) : Int;
 	var readyState(default,null) : Int;
-	
+
 	/**
 	/**
 		Returns a `Boolean` that indicates whether the media is in the process of seeking to a new position.
 		Returns a `Boolean` that indicates whether the media is in the process of seeking to a new position.
 	**/
 	**/
 	var seeking(default,null) : Bool;
 	var seeking(default,null) : Bool;
-	
+
 	/**
 	/**
 		Is a `double` indicating the current playback time in seconds. Setting this value seeks the media to the new time.
 		Is a `double` indicating the current playback time in seconds. Setting this value seeks the media to the new time.
 	**/
 	**/
 	var currentTime : Float;
 	var currentTime : Float;
-	
+
 	/**
 	/**
 		Returns a `double` indicating the length of the media in seconds, or 0 if no media data is available.
 		Returns a `double` indicating the length of the media in seconds, or 0 if no media data is available.
 	**/
 	**/
 	var duration(default,null) : Float;
 	var duration(default,null) : Float;
-	
+
 	/**
 	/**
 		Returns a `Boolean` that indicates whether the media element is paused.
 		Returns a `Boolean` that indicates whether the media element is paused.
 	**/
 	**/
 	var paused(default,null) : Bool;
 	var paused(default,null) : Bool;
-	
+
 	/**
 	/**
 		Is a `double` indicating the default playback rate for the media.
 		Is a `double` indicating the default playback rate for the media.
 	**/
 	**/
 	var defaultPlaybackRate : Float;
 	var defaultPlaybackRate : Float;
-	
+
 	/**
 	/**
 		Is a `double` that indicates the rate at which the media is being played back. 
 		Is a `double` that indicates the rate at which the media is being played back. 
 	**/
 	**/
 	var playbackRate : Float;
 	var playbackRate : Float;
-	
+
 	/**
 	/**
 		Returns a `TimeRanges` object that contains the ranges of the media source that the browser has played, if any.
 		Returns a `TimeRanges` object that contains the ranges of the media source that the browser has played, if any.
 	**/
 	**/
 	var played(default,null) : TimeRanges;
 	var played(default,null) : TimeRanges;
-	
+
 	/**
 	/**
 		Returns a `TimeRanges` object that contains the time ranges that the user is able to seek to, if any.
 		Returns a `TimeRanges` object that contains the time ranges that the user is able to seek to, if any.
 	**/
 	**/
 	var seekable(default,null) : TimeRanges;
 	var seekable(default,null) : TimeRanges;
-	
+
 	/**
 	/**
 		Returns a `Boolean` that indicates whether the media element has finished playing.
 		Returns a `Boolean` that indicates whether the media element has finished playing.
 	**/
 	**/
 	var ended(default,null) : Bool;
 	var ended(default,null) : Bool;
-	
+
 	/**
 	/**
 		A `Boolean` that reflects the `autoplay` HTML attribute, indicating whether playback should automatically begin as soon as enough media is available to do so without interruption.
 		A `Boolean` that reflects the `autoplay` HTML attribute, indicating whether playback should automatically begin as soon as enough media is available to do so without interruption.
 		 Sites which automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so it should be avoided when possible. If you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it). However, this can be useful when creating media elements whose source will be set at a later time, under user control.
 		 Sites which automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so it should be avoided when possible. If you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it). However, this can be useful when creating media elements whose source will be set at a later time, under user control.
-		 
+
 	**/
 	**/
 	var autoplay : Bool;
 	var autoplay : Bool;
-	
+
 	/**
 	/**
 		Is a `Boolean` that reflects the `loop` HTML attribute, which indicates whether the media element should start over when it reaches the end.
 		Is a `Boolean` that reflects the `loop` HTML attribute, which indicates whether the media element should start over when it reaches the end.
 	**/
 	**/
 	var loop : Bool;
 	var loop : Bool;
-	
+
 	/**
 	/**
 		Is a `Boolean` that reflects the `controls` HTML attribute, indicating whether user interface items for controlling the resource should be displayed.
 		Is a `Boolean` that reflects the `controls` HTML attribute, indicating whether user interface items for controlling the resource should be displayed.
 	**/
 	**/
 	var controls : Bool;
 	var controls : Bool;
-	
+
 	/**
 	/**
 		Is a `double` indicating the audio volume, from 0.0 (silent) to 1.0 (loudest).
 		Is a `double` indicating the audio volume, from 0.0 (silent) to 1.0 (loudest).
 	**/
 	**/
 	var volume : Float;
 	var volume : Float;
-	
+
 	/**
 	/**
 		Is a `Boolean` that determines whether audio is muted. `true` if the audio is muted and `false` otherwise.
 		Is a `Boolean` that determines whether audio is muted. `true` if the audio is muted and `false` otherwise.
 	**/
 	**/
 	var muted : Bool;
 	var muted : Bool;
-	
+
 	/**
 	/**
 		Is a `Boolean` that reflects the `muted` HTML attribute, which indicates whether the media element's audio output should be muted by default.
 		Is a `Boolean` that reflects the `muted` HTML attribute, which indicates whether the media element's audio output should be muted by default.
 	**/
 	**/
 	var defaultMuted : Bool;
 	var defaultMuted : Bool;
-	
+
 	/**
 	/**
 		A `AudioTrackList` that lists the `AudioTrack` objects contained in the element.
 		A `AudioTrackList` that lists the `AudioTrack` objects contained in the element.
 	**/
 	**/
 	var audioTracks(default,null) : AudioTrackList;
 	var audioTracks(default,null) : AudioTrackList;
-	
+
 	/**
 	/**
 		Returns the list of `VideoTrack` objects contained in the element.
 		Returns the list of `VideoTrack` objects contained in the element.
-		 
+
 		 Gecko supports only single track playback, and the parsing of tracks' metadata is only available for media with the Ogg container format.
 		 Gecko supports only single track playback, and the parsing of tracks' metadata is only available for media with the Ogg container format.
-		 
-		 
+
+
 	**/
 	**/
 	var videoTracks(default,null) : VideoTrackList;
 	var videoTracks(default,null) : VideoTrackList;
-	
+
 	/**
 	/**
 		Returns the list of `TextTrack` objects contained in the element.
 		Returns the list of `TextTrack` objects contained in the element.
 	**/
 	**/
 	var textTracks(default,null) : TextTrackList;
 	var textTracks(default,null) : TextTrackList;
-	
+
 	/**
 	/**
 		Is a `MediaStream` representing the media to play or that has played in the current `HTMLMediaElement`, or `null` if not assigned.
 		Is a `MediaStream` representing the media to play or that has played in the current `HTMLMediaElement`, or `null` if not assigned.
 	**/
 	**/
 	var srcObject : MediaStream;
 	var srcObject : MediaStream;
-	
+
 	/**
 	/**
 		Returns a `MediaKeys` object or `null`. MediaKeys is a set of keys that an associated HTMLMediaElement can use for decryption of media data during playback.
 		Returns a `MediaKeys` object or `null`. MediaKeys is a set of keys that an associated HTMLMediaElement can use for decryption of media data during playback.
 	**/
 	**/
 	var mediaKeys(default,null) : js.html.eme.MediaKeys;
 	var mediaKeys(default,null) : js.html.eme.MediaKeys;
-	
+
 	/**
 	/**
 		Sets the `EventHandler` called when the media is encrypted.
 		Sets the `EventHandler` called when the media is encrypted.
 	**/
 	**/
 	var onencrypted : haxe.Constraints.Function;
 	var onencrypted : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		Sets the `EventHandler` called when playback is blocked while waiting for an encryption key.
 		Sets the `EventHandler` called when playback is blocked while waiting for an encryption key.
 	**/
 	**/
 	var onwaitingforkey : haxe.Constraints.Function;
 	var onwaitingforkey : haxe.Constraints.Function;
-	
-	
+
+
 	/**
 	/**
 		Resets the media element and restarts the media resource. Any pending events are discarded. How much media data is fetched is still affected by the `preload` attribute. This method can be useful for releasing resources after any `src` attribute and `source` element descendants have been removed. Otherwise, it is usually unnecessary to use this method, unless required to rescan `source` element children after dynamic changes.
 		Resets the media element and restarts the media resource. Any pending events are discarded. How much media data is fetched is still affected by the `preload` attribute. This method can be useful for releasing resources after any `src` attribute and `source` element descendants have been removed. Otherwise, it is usually unnecessary to use this method, unless required to rescan `source` element children after dynamic changes.
 	**/
 	**/
 	function load() : Void;
 	function load() : Void;
-	
+
 	/**
 	/**
 		Determines whether the specified media type can be played back.
 		Determines whether the specified media type can be played back.
 	**/
 	**/
 	function canPlayType( type : String ) : String;
 	function canPlayType( type : String ) : String;
-	
+
 	/**
 	/**
 		Directly seeks to the given time.
 		Directly seeks to the given time.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function fastSeek( time : Float ) : Void;
 	function fastSeek( time : Float ) : Void;
-	
+
 	/**
 	/**
 		Begins playback of the media.
 		Begins playback of the media.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function play() : Promise<Void>;
 	function play() : Promise<Void>;
-	
+
 	/**
 	/**
 		Pauses the media playback.
 		Pauses the media playback.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function pause() : Void;
 	function pause() : Void;
-	
+
 	/**
 	/**
 		Adds a text track (such as a track for subtitles) to a media element.
 		Adds a text track (such as a track for subtitles) to a media element.
 	**/
 	**/
 	function addTextTrack( kind : TextTrackKind, label : String = "", language : String = "" ) : TextTrack;
 	function addTextTrack( kind : TextTrackKind, label : String = "", language : String = "" ) : TextTrack;
-	
+
 	/**
 	/**
 		Returns `Promise`. Sets the `MediaKeys` keys to use when decrypting media during playback.
 		Returns `Promise`. Sets the `MediaKeys` keys to use when decrypting media during playback.
 	**/
 	**/

+ 22 - 20
std/js/html/MediaStreamTrack.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `MediaStreamTrack` interface represents a single media track within a stream; typically, these are audio or video tracks, but other track types may exist as well.
 	The `MediaStreamTrack` interface represents a single media track within a stream; typically, these are audio or video tracks, but other track types may exist as well.
 
 
@@ -33,82 +35,82 @@ package js.html;
 **/
 **/
 @:native("MediaStreamTrack")
 @:native("MediaStreamTrack")
 extern class MediaStreamTrack extends EventTarget {
 extern class MediaStreamTrack extends EventTarget {
-	
+
 	/**
 	/**
 		Returns a `DOMString` set to `"audio"` if the track is an audio track and to `"video"`, if it is a video track. It doesn't change if the track is deassociated from its source.
 		Returns a `DOMString` set to `"audio"` if the track is an audio track and to `"video"`, if it is a video track. It doesn't change if the track is deassociated from its source.
 	**/
 	**/
 	var kind(default,null) : String;
 	var kind(default,null) : String;
-	
+
 	/**
 	/**
 		Returns a `DOMString` containing a unique identifier (GUID) for the track; it is generated by the browser.
 		Returns a `DOMString` containing a unique identifier (GUID) for the track; it is generated by the browser.
 	**/
 	**/
 	var id(default,null) : String;
 	var id(default,null) : String;
-	
+
 	/**
 	/**
 		Returns a `DOMString` containing a user agent-assigned label that identifies the track source, as in `"internal microphone"`. The string may be left empty and is empty as long as no source has been connected. When the track is deassociated from its source, the label is not changed.
 		Returns a `DOMString` containing a user agent-assigned label that identifies the track source, as in `"internal microphone"`. The string may be left empty and is empty as long as no source has been connected. When the track is deassociated from its source, the label is not changed.
 	**/
 	**/
 	var label(default,null) : String;
 	var label(default,null) : String;
-	
+
 	/**
 	/**
 		A Boolean whose value of `true` if the track is enabled, that is allowed to render the media source stream; or `false` if it is disabled, that is not rendering the media source stream but silence and blackness. If the track has been disconnected, this value can be changed but has no more effect.
 		A Boolean whose value of `true` if the track is enabled, that is allowed to render the media source stream; or `false` if it is disabled, that is not rendering the media source stream but silence and blackness. If the track has been disconnected, this value can be changed but has no more effect.
 		 Note: You can implement standard "mute" functionality by setting `enabled` to `false`. The `muted` property refers to a condition in which there's no media because of a technical issue.
 		 Note: You can implement standard "mute" functionality by setting `enabled` to `false`. The `muted` property refers to a condition in which there's no media because of a technical issue.
-		 
+
 	**/
 	**/
 	var enabled : Bool;
 	var enabled : Bool;
-	
+
 	/**
 	/**
 		Returns a Boolean value indicating whether the track is unable to provide media data due to a technical issue.
 		Returns a Boolean value indicating whether the track is unable to provide media data due to a technical issue.
 		 Note: You can implement standard "mute" functionality by setting `enabled` to `false`, and unmute the media by setting it back to `true` again.
 		 Note: You can implement standard "mute" functionality by setting `enabled` to `false`, and unmute the media by setting it back to `true` again.
-		 
+
 	**/
 	**/
 	var muted(default,null) : Bool;
 	var muted(default,null) : Bool;
-	
+
 	/**
 	/**
 		An `EventHandler` containing the action to perform when an `mute` event is fired on the object, that is when the streaming is terminating.
 		An `EventHandler` containing the action to perform when an `mute` event is fired on the object, that is when the streaming is terminating.
 	**/
 	**/
 	var onmute : haxe.Constraints.Function;
 	var onmute : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		An `EventHandler` containing the action to perform when an `unmute` event is fired on the object, that is when a  `MediaStreamTrack` object is removed from it.
 		An `EventHandler` containing the action to perform when an `unmute` event is fired on the object, that is when a  `MediaStreamTrack` object is removed from it.
 	**/
 	**/
 	var onunmute : haxe.Constraints.Function;
 	var onunmute : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		Returns an enumerated value giving the status of the track. This will be one of the following values:
 		Returns an enumerated value giving the status of the track. This will be one of the following values:
-		 
+
 		  `"live"` which indicates that an input is connected and does its best-effort in providing real-time data. In that case, the output of data can be switched on or off using the `MediaStreamTrack.enabled` attribute.
 		  `"live"` which indicates that an input is connected and does its best-effort in providing real-time data. In that case, the output of data can be switched on or off using the `MediaStreamTrack.enabled` attribute.
 		  `"ended"` which indicates that the input is not giving any more data and will never provide new data.
 		  `"ended"` which indicates that the input is not giving any more data and will never provide new data.
-		 
-		 
+
+
 	**/
 	**/
 	var readyState(default,null) : MediaStreamTrackState;
 	var readyState(default,null) : MediaStreamTrackState;
-	
+
 	/**
 	/**
 		An `EventHandler` containing the action to perform when an `ended_(MediaStream)` event is fired on the object, that is when a  `MediaStreamTrack` object is removed from it.
 		An `EventHandler` containing the action to perform when an `ended_(MediaStream)` event is fired on the object, that is when a  `MediaStreamTrack` object is removed from it.
 	**/
 	**/
 	var onended : haxe.Constraints.Function;
 	var onended : haxe.Constraints.Function;
-	
-	
+
+
 	/**
 	/**
 		Returns a duplicate of the `MediaStreamTrack`.
 		Returns a duplicate of the `MediaStreamTrack`.
 	**/
 	**/
 	function clone() : MediaStreamTrack;
 	function clone() : MediaStreamTrack;
-	
+
 	/**
 	/**
 		Stops playing the source associated to the track, both the source and the track are deassociated. The track state is set to `ended`.
 		Stops playing the source associated to the track, both the source and the track are deassociated. The track state is set to `ended`.
 	**/
 	**/
 	function stop() : Void;
 	function stop() : Void;
-	
+
 	/**
 	/**
 		Returns a `MediaTrackConstraints` object containing the currently set constraints for the track; the returned value matches the constraints last set using `MediaStreamTrack.applyConstraints`.
 		Returns a `MediaTrackConstraints` object containing the currently set constraints for the track; the returned value matches the constraints last set using `MediaStreamTrack.applyConstraints`.
 	**/
 	**/
 	function getConstraints() : MediaTrackConstraints;
 	function getConstraints() : MediaTrackConstraints;
-	
+
 	/**
 	/**
 		Returns a `MediaTrackSettings` object containing the current values of each of the `MediaStreamTrack`'s constrainable properties.
 		Returns a `MediaTrackSettings` object containing the current values of each of the `MediaStreamTrack`'s constrainable properties.
 	**/
 	**/
 	function getSettings() : MediaTrackSettings;
 	function getSettings() : MediaTrackSettings;
-	
+
 	/**
 	/**
 		Lets the application specify the ideal and/or ranges of acceptable values for any number of the available constrainable properties of the `MediaStreamTrack`.
 		Lets the application specify the ideal and/or ranges of acceptable values for any number of the available constrainable properties of the `MediaStreamTrack`.
 		@throws DOMError
 		@throws DOMError

+ 14 - 12
std/js/html/Navigator.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `Navigator` interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities.
 	The `Navigator` interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities.
 
 
@@ -33,61 +35,61 @@ package js.html;
 **/
 **/
 @:native("Navigator")
 @:native("Navigator")
 extern class Navigator {
 extern class Navigator {
-	
+
 	/**
 	/**
 		Returns a `Permissions` object that can be used to query and update permission status of APIs covered by the Permissions API.
 		Returns a `Permissions` object that can be used to query and update permission status of APIs covered by the Permissions API.
 	**/
 	**/
 	var permissions(default,null) : Permissions;
 	var permissions(default,null) : Permissions;
 	var mimeTypes(default,null) : MimeTypeArray;
 	var mimeTypes(default,null) : MimeTypeArray;
 	var plugins(default,null) : PluginArray;
 	var plugins(default,null) : PluginArray;
-	
+
 	/**
 	/**
 		Reports the value of the user's do-not-track preference. When this value is "yes", your web site or application should not track the user.
 		Reports the value of the user's do-not-track preference. When this value is "yes", your web site or application should not track the user.
 	**/
 	**/
 	var doNotTrack(default,null) : String;
 	var doNotTrack(default,null) : String;
 	var maxTouchPoints(default,null) : Int;
 	var maxTouchPoints(default,null) : Int;
-	
+
 	/**
 	/**
 		Returns a string that represents the current operating system.
 		Returns a string that represents the current operating system.
 	**/
 	**/
 	var oscpu(default,null) : String;
 	var oscpu(default,null) : String;
-	
+
 	/**
 	/**
 		Returns the vendor name of the current browser (e.g., "Netscape6").
 		Returns the vendor name of the current browser (e.g., "Netscape6").
 	**/
 	**/
 	var vendor(default,null) : String;
 	var vendor(default,null) : String;
-	
+
 	/**
 	/**
 		Returns the vendor version number (e.g. "6.1").
 		Returns the vendor version number (e.g. "6.1").
 	**/
 	**/
 	var vendorSub(default,null) : String;
 	var vendorSub(default,null) : String;
-	
+
 	/**
 	/**
 		Returns the build number of the current browser (e.g., "20060909").
 		Returns the build number of the current browser (e.g., "20060909").
 	**/
 	**/
 	var productSub(default,null) : String;
 	var productSub(default,null) : String;
-	
+
 	/**
 	/**
 		Returns false if setting a cookie will be ignored and true otherwise.
 		Returns false if setting a cookie will be ignored and true otherwise.
 	**/
 	**/
 	var cookieEnabled(default,null) : Bool;
 	var cookieEnabled(default,null) : Bool;
-	
+
 	/**
 	/**
 		Returns the build identifier of the browser (e.g., "2006090803").
 		Returns the build identifier of the browser (e.g., "2006090803").
 	**/
 	**/
 	var buildID(default,null) : String;
 	var buildID(default,null) : String;
-	
+
 	/**
 	/**
 		Returns a reference to a `MediaDevices` object which can then be used to get information about available media devices (`MediaDevices.enumerateDevices()`), find out what constrainable properties are supported for media on the user's computer and user agent (`MediaDevices.getSupportedConstraints()`), and to request access to media using `MediaDevices.getUserMedia()`.
 		Returns a reference to a `MediaDevices` object which can then be used to get information about available media devices (`MediaDevices.enumerateDevices()`), find out what constrainable properties are supported for media on the user's computer and user agent (`MediaDevices.getSupportedConstraints()`), and to request access to media using `MediaDevices.getUserMedia()`.
 	**/
 	**/
 	var mediaDevices(default,null) : MediaDevices;
 	var mediaDevices(default,null) : MediaDevices;
-	
+
 	/**
 	/**
 		Returns a `ServiceWorkerContainer` object, which provides access to registration, removal, upgrade, and communication with the `ServiceWorker` objects for the associated document.
 		Returns a `ServiceWorkerContainer` object, which provides access to registration, removal, upgrade, and communication with the `ServiceWorker` objects for the associated document.
 	**/
 	**/
 	var serviceWorker(default,null) : ServiceWorkerContainer;
 	var serviceWorker(default,null) : ServiceWorkerContainer;
 	var hardwareConcurrency(default,null) : Int;
 	var hardwareConcurrency(default,null) : Int;
-	
+
 	/**
 	/**
 		Returns a `Geolocation` object allowing accessing the location of the device.
 		Returns a `Geolocation` object allowing accessing the location of the device.
 	**/
 	**/
@@ -102,7 +104,7 @@ extern class Navigator {
 	var languages(default,null) : Array<String>;
 	var languages(default,null) : Array<String>;
 	var onLine(default,null) : Bool;
 	var onLine(default,null) : Bool;
 	var storage(default,null) : StorageManager;
 	var storage(default,null) : StorageManager;
-	
+
 	@:overload( function( duration : Int ) : Bool {} )
 	@:overload( function( duration : Int ) : Bool {} )
 	function vibrate( pattern : Array<Int> ) : Bool;
 	function vibrate( pattern : Array<Int> ) : Bool;
 	function javaEnabled() : Bool;
 	function javaEnabled() : Bool;

+ 3 - 1
std/js/html/Permissions.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	Documentation [Permissions](https://developer.mozilla.org/en-US/docs/Web/API/Permissions) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/Permissions$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
 	Documentation [Permissions](https://developer.mozilla.org/en-US/docs/Web/API/Permissions) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/Permissions$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
 
 
@@ -31,7 +33,7 @@ package js.html;
 **/
 **/
 @:native("Permissions")
 @:native("Permissions")
 extern class Permissions {
 extern class Permissions {
-	
+
 	/**
 	/**
 		Returns the user permission status for a given API.
 		Returns the user permission status for a given API.
 		@throws DOMError
 		@throws DOMError

+ 15 - 13
std/js/html/Request.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `Request` interface of the Fetch API represents a resource request.
 	The `Request` interface of the Fetch API represents a resource request.
 
 
@@ -33,68 +35,68 @@ package js.html;
 **/
 **/
 @:native("Request")
 @:native("Request")
 extern class Request {
 extern class Request {
-	
+
 	/**
 	/**
 		Contains the request's method (`GET`, `POST`, etc.)
 		Contains the request's method (`GET`, `POST`, etc.)
 	**/
 	**/
 	var method(default,null) : String;
 	var method(default,null) : String;
-	
+
 	/**
 	/**
 		Contains the URL of the request.
 		Contains the URL of the request.
 	**/
 	**/
 	var url(default,null) : String;
 	var url(default,null) : String;
-	
+
 	/**
 	/**
 		Contains the associated `Headers` object of the request.
 		Contains the associated `Headers` object of the request.
 	**/
 	**/
 	var headers(default,null) : Headers;
 	var headers(default,null) : Headers;
-	
+
 	/**
 	/**
 		Returns a string from the `RequestDestination` enum describing the request's destination. This is a string indicating the type of content being requested.
 		Returns a string from the `RequestDestination` enum describing the request's destination. This is a string indicating the type of content being requested.
 	**/
 	**/
 	var destination(default,null) : RequestDestination;
 	var destination(default,null) : RequestDestination;
-	
+
 	/**
 	/**
 		Contains the referrer of the request (e.g., `client`).
 		Contains the referrer of the request (e.g., `client`).
 	**/
 	**/
 	var referrer(default,null) : String;
 	var referrer(default,null) : String;
-	
+
 	/**
 	/**
 		Contains the referrer policy of the request (e.g., `no-referrer`).
 		Contains the referrer policy of the request (e.g., `no-referrer`).
 	**/
 	**/
 	var referrerPolicy(default,null) : ReferrerPolicy;
 	var referrerPolicy(default,null) : ReferrerPolicy;
-	
+
 	/**
 	/**
 		Contains the mode of the request (e.g., `cors`, `no-cors`, `same-origin`, `navigate`.)
 		Contains the mode of the request (e.g., `cors`, `no-cors`, `same-origin`, `navigate`.)
 	**/
 	**/
 	var mode(default,null) : RequestMode;
 	var mode(default,null) : RequestMode;
-	
+
 	/**
 	/**
 		Contains the credentials of the request (e.g., `"omit"`, `"same-origin"`, `"include"`). The default is `"same-origin"`.
 		Contains the credentials of the request (e.g., `"omit"`, `"same-origin"`, `"include"`). The default is `"same-origin"`.
 	**/
 	**/
 	var credentials(default,null) : RequestCredentials;
 	var credentials(default,null) : RequestCredentials;
-	
+
 	/**
 	/**
 		Contains the cache mode of the request (e.g., `default`, `reload`, `no-cache`).
 		Contains the cache mode of the request (e.g., `default`, `reload`, `no-cache`).
 	**/
 	**/
 	var cache(default,null) : RequestCache;
 	var cache(default,null) : RequestCache;
-	
+
 	/**
 	/**
 		Contains the mode for how redirects are handled. It may be one of `follow`, `error`, or `manual`.
 		Contains the mode for how redirects are handled. It may be one of `follow`, `error`, or `manual`.
 	**/
 	**/
 	var redirect(default,null) : RequestRedirect;
 	var redirect(default,null) : RequestRedirect;
-	
+
 	/**
 	/**
 		Contains the subresource integrity value of the request (e.g., `sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=`).
 		Contains the subresource integrity value of the request (e.g., `sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=`).
 	**/
 	**/
 	var integrity(default,null) : String;
 	var integrity(default,null) : String;
 	var signal(default,null) : AbortSignal;
 	var signal(default,null) : AbortSignal;
 	var bodyUsed(default,null) : Bool;
 	var bodyUsed(default,null) : Bool;
-	
+
 	/** @throws DOMError */
 	/** @throws DOMError */
 	@:overload( function( input : String, ?init : RequestInit) : Request {} )
 	@:overload( function( input : String, ?init : RequestInit) : Request {} )
 	function new( input : Request, ?init : RequestInit ) : Void;
 	function new( input : Request, ?init : RequestInit ) : Void;
-	
+
 	/**
 	/**
 		Creates a copy of the current `Request` object.
 		Creates a copy of the current `Request` object.
 		@throws DOMError
 		@throws DOMError

+ 13 - 11
std/js/html/Response.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `Response` interface of the Fetch API represents the response to a request.
 	The `Response` interface of the Fetch API represents the response to a request.
 
 
@@ -33,54 +35,54 @@ package js.html;
 **/
 **/
 @:native("Response")
 @:native("Response")
 extern class Response {
 extern class Response {
-	
+
 	/**
 	/**
 		Returns a new `Response` object associated with a network error.
 		Returns a new `Response` object associated with a network error.
 	**/
 	**/
 	static function error() : Response;
 	static function error() : Response;
-	
+
 	/**
 	/**
 		Creates a new response with a different URL.
 		Creates a new response with a different URL.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	static function redirect( url : String, status : Int = 302 ) : Response;
 	static function redirect( url : String, status : Int = 302 ) : Response;
-	
+
 	/**
 	/**
 		Contains the type of the response (e.g., `basic`, `cors`).
 		Contains the type of the response (e.g., `basic`, `cors`).
 	**/
 	**/
 	var type(default,null) : ResponseType;
 	var type(default,null) : ResponseType;
-	
+
 	/**
 	/**
 		Contains the URL of the response.
 		Contains the URL of the response.
 	**/
 	**/
 	var url(default,null) : String;
 	var url(default,null) : String;
-	
+
 	/**
 	/**
 		Indicates whether or not the response is the result of a redirect; that is, its URL list has more than one entry.
 		Indicates whether or not the response is the result of a redirect; that is, its URL list has more than one entry.
 	**/
 	**/
 	var redirected(default,null) : Bool;
 	var redirected(default,null) : Bool;
-	
+
 	/**
 	/**
 		Contains the status code of the response (e.g., `200` for a success).
 		Contains the status code of the response (e.g., `200` for a success).
 	**/
 	**/
 	var status(default,null) : Int;
 	var status(default,null) : Int;
-	
+
 	/**
 	/**
 		Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
 		Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
 	**/
 	**/
 	var ok(default,null) : Bool;
 	var ok(default,null) : Bool;
-	
+
 	/**
 	/**
 		Contains the status message corresponding to the status code (e.g., `OK` for `200`).
 		Contains the status message corresponding to the status code (e.g., `OK` for `200`).
 	**/
 	**/
 	var statusText(default,null) : String;
 	var statusText(default,null) : String;
-	
+
 	/**
 	/**
 		Contains the `Headers` object associated with the response.
 		Contains the `Headers` object associated with the response.
 	**/
 	**/
 	var headers(default,null) : Headers;
 	var headers(default,null) : Headers;
 	var bodyUsed(default,null) : Bool;
 	var bodyUsed(default,null) : Bool;
-	
+
 	/** @throws DOMError */
 	/** @throws DOMError */
 	@:overload( function( ?body : js.lib.ArrayBufferView, ?init : ResponseInit) : Response {} )
 	@:overload( function( ?body : js.lib.ArrayBufferView, ?init : ResponseInit) : Response {} )
 	@:overload( function( ?body : js.lib.ArrayBuffer, ?init : ResponseInit) : Response {} )
 	@:overload( function( ?body : js.lib.ArrayBuffer, ?init : ResponseInit) : Response {} )
@@ -89,7 +91,7 @@ extern class Response {
 	@:overload( function( ?body : Dynamic/*MISSING ReadableStream*/, ?init : ResponseInit) : Response {} )
 	@:overload( function( ?body : Dynamic/*MISSING ReadableStream*/, ?init : ResponseInit) : Response {} )
 	@:overload( function( ?body : String, ?init : ResponseInit) : Response {} )
 	@:overload( function( ?body : String, ?init : ResponseInit) : Response {} )
 	function new( ?body : Blob, ?init : ResponseInit ) : Void;
 	function new( ?body : Blob, ?init : ResponseInit ) : Void;
-	
+
 	/**
 	/**
 		Creates a clone of a `Response` object.
 		Creates a clone of a `Response` object.
 		@throws DOMError
 		@throws DOMError

+ 8 - 6
std/js/html/ScreenOrientation.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `ScreenOrientation` interface of the the Screen Orientation API provides information about the current orientation of the document.
 	The `ScreenOrientation` interface of the the Screen Orientation API provides information about the current orientation of the document.
 
 
@@ -33,29 +35,29 @@ package js.html;
 **/
 **/
 @:native("ScreenOrientation")
 @:native("ScreenOrientation")
 extern class ScreenOrientation extends EventTarget {
 extern class ScreenOrientation extends EventTarget {
-	
+
 	/**
 	/**
 		Returns the document's current orientation type, one of "portrait-primary", "portrait-secondary", "landscape-primary", or "landscape-secondary".
 		Returns the document's current orientation type, one of "portrait-primary", "portrait-secondary", "landscape-primary", or "landscape-secondary".
 	**/
 	**/
 	var type(default,null) : OrientationType;
 	var type(default,null) : OrientationType;
-	
+
 	/**
 	/**
 		Returns the document's current orientation angle.
 		Returns the document's current orientation angle.
 	**/
 	**/
 	var angle(default,null) : Int;
 	var angle(default,null) : Int;
-	
+
 	/**
 	/**
 		Fired whenever is the `EventHandler` called when the screen changes orientation.
 		Fired whenever is the `EventHandler` called when the screen changes orientation.
 	**/
 	**/
 	var onchange : haxe.Constraints.Function;
 	var onchange : haxe.Constraints.Function;
-	
-	
+
+
 	/**
 	/**
 		Locks the orientation of the containing document to its default orientation and returns a `Promise`. 
 		Locks the orientation of the containing document to its default orientation and returns a `Promise`. 
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function lock( orientation : OrientationLockType ) : Promise<Void>;
 	function lock( orientation : OrientationLockType ) : Promise<Void>;
-	
+
 	/**
 	/**
 		Unlocks the orientation of the containing document from its default orientation.
 		Unlocks the orientation of the containing document from its default orientation.
 		@throws DOMError
 		@throws DOMError

+ 10 - 8
std/js/html/ServiceWorkerContainer.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `ServiceWorkerContainer` interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations.
 	The `ServiceWorkerContainer` interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations.
 
 
@@ -33,39 +35,39 @@ package js.html;
 **/
 **/
 @:native("ServiceWorkerContainer")
 @:native("ServiceWorkerContainer")
 extern class ServiceWorkerContainer extends EventTarget {
 extern class ServiceWorkerContainer extends EventTarget {
-	
+
 	/**
 	/**
 		Returns a `ServiceWorker` object if its state is `activated` (the same object returned by `ServiceWorkerRegistration.active`). This property returns `null` during a force-refresh request (Shift + refresh) or if there is no active worker.
 		Returns a `ServiceWorker` object if its state is `activated` (the same object returned by `ServiceWorkerRegistration.active`). This property returns `null` during a force-refresh request (Shift + refresh) or if there is no active worker.
 	**/
 	**/
 	var controller(default,null) : ServiceWorker;
 	var controller(default,null) : ServiceWorker;
-	
+
 	/**
 	/**
 		Provides a way of delaying code execution until a service worker is active. It returns a `Promise` that will never reject, and which waits indefinitely until the `ServiceWorkerRegistration` associated with the current page has an `ServiceWorkerRegistration.active` worker. Once that condition is met, it resolves with the `ServiceWorkerRegistration`.
 		Provides a way of delaying code execution until a service worker is active. It returns a `Promise` that will never reject, and which waits indefinitely until the `ServiceWorkerRegistration` associated with the current page has an `ServiceWorkerRegistration.active` worker. Once that condition is met, it resolves with the `ServiceWorkerRegistration`.
 	**/
 	**/
 	var ready(default,null) : Promise<ServiceWorkerRegistration>;
 	var ready(default,null) : Promise<ServiceWorkerRegistration>;
-	
+
 	/**
 	/**
 		Fired whenever a `controllerchange` event occurs — when the document's associated `ServiceWorkerRegistration` acquires a new `ServiceWorkerRegistration.active` worker.
 		Fired whenever a `controllerchange` event occurs — when the document's associated `ServiceWorkerRegistration` acquires a new `ServiceWorkerRegistration.active` worker.
 	**/
 	**/
 	var oncontrollerchange : haxe.Constraints.Function;
 	var oncontrollerchange : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		Fired whenever an `error` event occurs in the associated service workers.
 		Fired whenever an `error` event occurs in the associated service workers.
 	**/
 	**/
 	var onerror : haxe.Constraints.Function;
 	var onerror : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		Fired whenever a `message` event occurs — when incoming messages are received to the `ServiceWorkerContainer` object (e.g. via a `MessagePort.postMessage()` call.)
 		Fired whenever a `message` event occurs — when incoming messages are received to the `ServiceWorkerContainer` object (e.g. via a `MessagePort.postMessage()` call.)
 	**/
 	**/
 	var onmessage : haxe.Constraints.Function;
 	var onmessage : haxe.Constraints.Function;
-	
+
 	function register( scriptURL : String, ?options : RegistrationOptions ) : Promise<ServiceWorkerRegistration>;
 	function register( scriptURL : String, ?options : RegistrationOptions ) : Promise<ServiceWorkerRegistration>;
-	
+
 	/**
 	/**
 		Gets a `ServiceWorkerRegistration` object whose scope matches the provided document URL.  If the method can't return a `ServiceWorkerRegistration`, it returns a `Promise`. 
 		Gets a `ServiceWorkerRegistration` object whose scope matches the provided document URL.  If the method can't return a `ServiceWorkerRegistration`, it returns a `Promise`. 
 	**/
 	**/
 	function getRegistration( documentURL : String = "" ) : Promise<Dynamic>;
 	function getRegistration( documentURL : String = "" ) : Promise<Dynamic>;
-	
+
 	/**
 	/**
 		Returns all `ServiceWorkerRegistration` objects associated with a `ServiceWorkerContainer` in an array.  If the method can't return `ServiceWorkerRegistration` objects, it returns a `Promise`. 
 		Returns all `ServiceWorkerRegistration` objects associated with a `ServiceWorkerContainer` in an array.  If the method can't return `ServiceWorkerRegistration` objects, it returns a `Promise`. 
 	**/
 	**/

+ 13 - 11
std/js/html/ServiceWorkerRegistration.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `ServiceWorkerRegistration` interface of the ServiceWorker API represents the service worker registration. You register a service worker to control one or more pages that share the same origin.
 	The `ServiceWorkerRegistration` interface of the ServiceWorker API represents the service worker registration. You register a service worker to control one or more pages that share the same origin.
 
 
@@ -33,57 +35,57 @@ package js.html;
 **/
 **/
 @:native("ServiceWorkerRegistration")
 @:native("ServiceWorkerRegistration")
 extern class ServiceWorkerRegistration extends EventTarget {
 extern class ServiceWorkerRegistration extends EventTarget {
-	
+
 	/**
 	/**
 		Returns a service worker whose state is `installing`. This is initially set to `null`.
 		Returns a service worker whose state is `installing`. This is initially set to `null`.
 	**/
 	**/
 	var installing(default,null) : ServiceWorker;
 	var installing(default,null) : ServiceWorker;
-	
+
 	/**
 	/**
 		Returns a service worker whose state is `waiting`. This is initially set to `null`.
 		Returns a service worker whose state is `waiting`. This is initially set to `null`.
 	**/
 	**/
 	var waiting(default,null) : ServiceWorker;
 	var waiting(default,null) : ServiceWorker;
-	
+
 	/**
 	/**
 		Returns a service worker whose state is either `activating` or `activated`. This is initially set to `null`. An active worker will control a `ServiceWorkerClient` if the client's URL falls within the scope of the registration (the `scope` option set when `ServiceWorkerContainer.register` is first called.)
 		Returns a service worker whose state is either `activating` or `activated`. This is initially set to `null`. An active worker will control a `ServiceWorkerClient` if the client's URL falls within the scope of the registration (the `scope` option set when `ServiceWorkerContainer.register` is first called.)
 	**/
 	**/
 	var active(default,null) : ServiceWorker;
 	var active(default,null) : ServiceWorker;
-	
+
 	/**
 	/**
 		Returns a unique identifier for a service worker registration. This must be on the same origin as the document that registers the `ServiceWorker`.
 		Returns a unique identifier for a service worker registration. This must be on the same origin as the document that registers the `ServiceWorker`.
 	**/
 	**/
 	var scope(default,null) : String;
 	var scope(default,null) : String;
 	var updateViaCache(default,null) : ServiceWorkerUpdateViaCache;
 	var updateViaCache(default,null) : ServiceWorkerUpdateViaCache;
-	
+
 	/**
 	/**
 		An `EventListener` property called whenever an event of type `updatefound` is fired; it is fired any time the `ServiceWorkerRegistration.installing` property acquires a new service worker.
 		An `EventListener` property called whenever an event of type `updatefound` is fired; it is fired any time the `ServiceWorkerRegistration.installing` property acquires a new service worker.
 	**/
 	**/
 	var onupdatefound : haxe.Constraints.Function;
 	var onupdatefound : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		Returns a reference to the `PushManager` interface for managing push subscriptions including subscribing, getting an active subscription, and accessing push permission status.
 		Returns a reference to the `PushManager` interface for managing push subscriptions including subscribing, getting an active subscription, and accessing push permission status.
 	**/
 	**/
 	var pushManager(default,null) : js.html.push.PushManager;
 	var pushManager(default,null) : js.html.push.PushManager;
-	
-	
+
+
 	/**
 	/**
 		Checks the server for an updated version of the service worker without consulting caches.
 		Checks the server for an updated version of the service worker without consulting caches.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function update() : Promise<Void>;
 	function update() : Promise<Void>;
-	
+
 	/**
 	/**
 		Unregisters the service worker registration and returns a `Promise`. The service worker will finish any ongoing operations before it is unregistered.
 		Unregisters the service worker registration and returns a `Promise`. The service worker will finish any ongoing operations before it is unregistered.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function unregister() : Promise<Bool>;
 	function unregister() : Promise<Bool>;
-	
+
 	/**
 	/**
 		Displays the notification with the requested title.
 		Displays the notification with the requested title.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function showNotification( title : String, ?options : NotificationOptions ) : Promise<Void>;
 	function showNotification( title : String, ?options : NotificationOptions ) : Promise<Void>;
-	
+
 	/**
 	/**
 		Returns a `Promise` that resolves to an array of `Notification` objects.
 		Returns a `Promise` that resolves to an array of `Notification` objects.
 		@throws DOMError
 		@throws DOMError

+ 5 - 3
std/js/html/StorageManager.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `StorageManager` interface of the the Storage API provides an interface for managing persistance permissions and estimating available storage. You can get a reference to this interface using either `navigator.storage` or `WorkerNavigator.storage`.
 	The `StorageManager` interface of the the Storage API provides an interface for managing persistance permissions and estimating available storage. You can get a reference to this interface using either `navigator.storage` or `WorkerNavigator.storage`.
 
 
@@ -33,19 +35,19 @@ package js.html;
 **/
 **/
 @:native("StorageManager")
 @:native("StorageManager")
 extern class StorageManager {
 extern class StorageManager {
-	
+
 	/**
 	/**
 		Returns a `Promise` that resolves to `true` if persistence has already been granted for your site's storage.
 		Returns a `Promise` that resolves to `true` if persistence has already been granted for your site's storage.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function persisted() : Promise<Bool>;
 	function persisted() : Promise<Bool>;
-	
+
 	/**
 	/**
 		Returns a `Promise` that resolves to `true` if the user agent is able to persist your site's storage.
 		Returns a `Promise` that resolves to `true` if the user agent is able to persist your site's storage.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function persist() : Promise<Bool>;
 	function persist() : Promise<Bool>;
-	
+
 	/**
 	/**
 		Returns a `StorageEstimate` object containing usage and quota numbers for your origin.
 		Returns a `StorageEstimate` object containing usage and quota numbers for your origin.
 		@throws DOMError
 		@throws DOMError

+ 14 - 12
std/js/html/SubtleCrypto.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `SubtleCrypto` interface represents a set of cryptographic primitives. It is available via the `Crypto.subtle` properties available in a window context (via `Window.crypto`).
 	The `SubtleCrypto` interface represents a set of cryptographic primitives. It is available via the `Crypto.subtle` properties available in a window context (via `Window.crypto`).
 
 
@@ -33,77 +35,77 @@ package js.html;
 **/
 **/
 @:native("SubtleCrypto")
 @:native("SubtleCrypto")
 extern class SubtleCrypto {
 extern class SubtleCrypto {
-	
+
 	/**
 	/**
 		Returns a `Promise` of the encrypted data corresponding to the clear text, algorithm and key given as parameters.
 		Returns a `Promise` of the encrypted data corresponding to the clear text, algorithm and key given as parameters.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function encrypt( algorithm : haxe.extern.EitherType<Dynamic,String>, key : CryptoKey, data : haxe.extern.EitherType<js.lib.ArrayBufferView,js.lib.ArrayBuffer> ) : Promise<Dynamic>;
 	function encrypt( algorithm : haxe.extern.EitherType<Dynamic,String>, key : CryptoKey, data : haxe.extern.EitherType<js.lib.ArrayBufferView,js.lib.ArrayBuffer> ) : Promise<Dynamic>;
-	
+
 	/**
 	/**
 		Returns a `Promise` of the clear data corresponding to the encrypted text, algorithm and key given as parameters.
 		Returns a `Promise` of the clear data corresponding to the encrypted text, algorithm and key given as parameters.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function decrypt( algorithm : haxe.extern.EitherType<Dynamic,String>, key : CryptoKey, data : haxe.extern.EitherType<js.lib.ArrayBufferView,js.lib.ArrayBuffer> ) : Promise<Dynamic>;
 	function decrypt( algorithm : haxe.extern.EitherType<Dynamic,String>, key : CryptoKey, data : haxe.extern.EitherType<js.lib.ArrayBufferView,js.lib.ArrayBuffer> ) : Promise<Dynamic>;
-	
+
 	/**
 	/**
 		Returns a `Promise` of the signature corresponding to the text, algorithm and key given as parameters.
 		Returns a `Promise` of the signature corresponding to the text, algorithm and key given as parameters.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function sign( algorithm : haxe.extern.EitherType<Dynamic,String>, key : CryptoKey, data : haxe.extern.EitherType<js.lib.ArrayBufferView,js.lib.ArrayBuffer> ) : Promise<Dynamic>;
 	function sign( algorithm : haxe.extern.EitherType<Dynamic,String>, key : CryptoKey, data : haxe.extern.EitherType<js.lib.ArrayBufferView,js.lib.ArrayBuffer> ) : Promise<Dynamic>;
-	
+
 	/**
 	/**
 		Returns a `Promise` of a `Boolean` value indicating if the signature given as parameter matches the text, algorithm and key also given as parameters.
 		Returns a `Promise` of a `Boolean` value indicating if the signature given as parameter matches the text, algorithm and key also given as parameters.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function verify( algorithm : haxe.extern.EitherType<Dynamic,String>, key : CryptoKey, signature : haxe.extern.EitherType<js.lib.ArrayBufferView,js.lib.ArrayBuffer>, data : haxe.extern.EitherType<js.lib.ArrayBufferView,js.lib.ArrayBuffer> ) : Promise<Dynamic>;
 	function verify( algorithm : haxe.extern.EitherType<Dynamic,String>, key : CryptoKey, signature : haxe.extern.EitherType<js.lib.ArrayBufferView,js.lib.ArrayBuffer>, data : haxe.extern.EitherType<js.lib.ArrayBufferView,js.lib.ArrayBuffer> ) : Promise<Dynamic>;
-	
+
 	/**
 	/**
 		Returns a `Promise` of a digest generated from the algorithm and text given as parameters.
 		Returns a `Promise` of a digest generated from the algorithm and text given as parameters.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function digest( algorithm : haxe.extern.EitherType<Dynamic,String>, data : haxe.extern.EitherType<js.lib.ArrayBufferView,js.lib.ArrayBuffer> ) : Promise<Dynamic>;
 	function digest( algorithm : haxe.extern.EitherType<Dynamic,String>, data : haxe.extern.EitherType<js.lib.ArrayBufferView,js.lib.ArrayBuffer> ) : Promise<Dynamic>;
-	
+
 	/**
 	/**
 		Returns a `Promise` of a newly generated `CryptoKey`, for symmetrical algorithms, or a `CryptoKeyPair`, containing two newly generated keys, for asymmetrical algorithm, that matches the algorithm, the usages and the extractability given as parameters.
 		Returns a `Promise` of a newly generated `CryptoKey`, for symmetrical algorithms, or a `CryptoKeyPair`, containing two newly generated keys, for asymmetrical algorithm, that matches the algorithm, the usages and the extractability given as parameters.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	@:overload( function( algorithm : String, extractable : Bool, keyUsages : Array<String>) : Promise<Dynamic> {} )
 	@:overload( function( algorithm : String, extractable : Bool, keyUsages : Array<String>) : Promise<Dynamic> {} )
 	function generateKey( algorithm : Dynamic, extractable : Bool, keyUsages : Array<String> ) : Promise<Dynamic>;
 	function generateKey( algorithm : Dynamic, extractable : Bool, keyUsages : Array<String> ) : Promise<Dynamic>;
-	
+
 	/**
 	/**
 		Returns a `Promise` of a newly generated `CryptoKey` derived from a master key and a specific algorithm given as parameters.
 		Returns a `Promise` of a newly generated `CryptoKey` derived from a master key and a specific algorithm given as parameters.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function deriveKey( algorithm : haxe.extern.EitherType<Dynamic,String>, baseKey : CryptoKey, derivedKeyType : haxe.extern.EitherType<Dynamic,String>, extractable : Bool, keyUsages : Array<String> ) : Promise<Dynamic>;
 	function deriveKey( algorithm : haxe.extern.EitherType<Dynamic,String>, baseKey : CryptoKey, derivedKeyType : haxe.extern.EitherType<Dynamic,String>, extractable : Bool, keyUsages : Array<String> ) : Promise<Dynamic>;
-	
+
 	/**
 	/**
 		Returns a `Promise` of a newly generated buffer of pseudo-random bits derived from a master key and a specific algorithm given as parameters.
 		Returns a `Promise` of a newly generated buffer of pseudo-random bits derived from a master key and a specific algorithm given as parameters.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	@:overload( function( algorithm : String, baseKey : CryptoKey, length : Int) : Promise<Dynamic> {} )
 	@:overload( function( algorithm : String, baseKey : CryptoKey, length : Int) : Promise<Dynamic> {} )
 	function deriveBits( algorithm : Dynamic, baseKey : CryptoKey, length : Int ) : Promise<Dynamic>;
 	function deriveBits( algorithm : Dynamic, baseKey : CryptoKey, length : Int ) : Promise<Dynamic>;
-	
+
 	/**
 	/**
 		Returns a `Promise` of a `CryptoKey` corresponding to the format, the algorithm, the raw key data, the usages and the extractability given as parameters.
 		Returns a `Promise` of a `CryptoKey` corresponding to the format, the algorithm, the raw key data, the usages and the extractability given as parameters.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	@:overload( function( format : String, keyData : Dynamic, algorithm : String, extractable : Bool, keyUsages : Array<String>) : Promise<Dynamic> {} )
 	@:overload( function( format : String, keyData : Dynamic, algorithm : String, extractable : Bool, keyUsages : Array<String>) : Promise<Dynamic> {} )
 	function importKey( format : String, keyData : Dynamic, algorithm : Dynamic, extractable : Bool, keyUsages : Array<String> ) : Promise<Dynamic>;
 	function importKey( format : String, keyData : Dynamic, algorithm : Dynamic, extractable : Bool, keyUsages : Array<String> ) : Promise<Dynamic>;
-	
+
 	/**
 	/**
 		Returns a `Promise` of a buffer containing the key in the format requested.
 		Returns a `Promise` of a buffer containing the key in the format requested.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function exportKey( format : String, key : CryptoKey ) : Promise<Dynamic>;
 	function exportKey( format : String, key : CryptoKey ) : Promise<Dynamic>;
-	
+
 	/**
 	/**
 		Returns a `Promise` of a wrapped symmetric key for usage (transfer, storage) in insecure environments. The wrapped buffer returned is in the format given in parameters, and contains the key wrapped by the given wrapping key with the given algorithm.
 		Returns a `Promise` of a wrapped symmetric key for usage (transfer, storage) in insecure environments. The wrapped buffer returned is in the format given in parameters, and contains the key wrapped by the given wrapping key with the given algorithm.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	@:overload( function( format : String, key : CryptoKey, wrappingKey : CryptoKey, wrapAlgorithm : String) : Promise<Dynamic> {} )
 	@:overload( function( format : String, key : CryptoKey, wrappingKey : CryptoKey, wrapAlgorithm : String) : Promise<Dynamic> {} )
 	function wrapKey( format : String, key : CryptoKey, wrappingKey : CryptoKey, wrapAlgorithm : Dynamic ) : Promise<Dynamic>;
 	function wrapKey( format : String, key : CryptoKey, wrappingKey : CryptoKey, wrapAlgorithm : Dynamic ) : Promise<Dynamic>;
-	
+
 	/**
 	/**
 		Returns a `Promise` of a `CryptoKey` corresponding to the wrapped key given in parameter.
 		Returns a `Promise` of a `CryptoKey` corresponding to the wrapped key given in parameter.
 		@throws DOMError
 		@throws DOMError

+ 81 - 79
std/js/html/Window.hx

@@ -24,6 +24,8 @@
 
 
 package js.html;
 package js.html;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `Window` interface represents a window containing a DOM document; the `document` property points to the DOM document loaded in that window.
 	The `Window` interface represents a window containing a DOM document; the `document` property points to the DOM document loaded in that window.
 
 
@@ -33,197 +35,197 @@ package js.html;
 **/
 **/
 @:native("Window")
 @:native("Window")
 extern class Window extends EventTarget {
 extern class Window extends EventTarget {
-	
+
 	/**
 	/**
 		Returns a reference to the current window.
 		Returns a reference to the current window.
 	**/
 	**/
 	var window(default,null) : Window;
 	var window(default,null) : Window;
-	
+
 	/**
 	/**
 		Returns an object reference to the window object itself.
 		Returns an object reference to the window object itself.
 	**/
 	**/
 	var self(default,null) : Window;
 	var self(default,null) : Window;
-	
+
 	/**
 	/**
 		Returns a reference to the document that the window contains.
 		Returns a reference to the document that the window contains.
 	**/
 	**/
 	var document(default,null) : HTMLDocument;
 	var document(default,null) : HTMLDocument;
-	
+
 	/**
 	/**
 		Gets/sets the name of the window.
 		Gets/sets the name of the window.
 	**/
 	**/
 	var name : String;
 	var name : String;
-	
+
 	/**
 	/**
 		Gets/sets the location, or current URL, of the window object.
 		Gets/sets the location, or current URL, of the window object.
 	**/
 	**/
 	var location(default,null) : Location;
 	var location(default,null) : Location;
-	
+
 	/**
 	/**
 		Returns a reference to the history object.
 		Returns a reference to the history object.
 	**/
 	**/
 	var history(default,null) : History;
 	var history(default,null) : History;
-	
+
 	/**
 	/**
 		Returns the locationbar object, whose visibility can be toggled in the window.
 		Returns the locationbar object, whose visibility can be toggled in the window.
 	**/
 	**/
 	var locationbar(default,null) : BarProp;
 	var locationbar(default,null) : BarProp;
-	
+
 	/**
 	/**
 		Returns the menubar object, whose visibility can be toggled in the window.
 		Returns the menubar object, whose visibility can be toggled in the window.
 	**/
 	**/
 	var menubar(default,null) : BarProp;
 	var menubar(default,null) : BarProp;
-	
+
 	/**
 	/**
 		Returns the personalbar object, whose visibility can be toggled in the window.
 		Returns the personalbar object, whose visibility can be toggled in the window.
 	**/
 	**/
 	var personalbar(default,null) : BarProp;
 	var personalbar(default,null) : BarProp;
-	
+
 	/**
 	/**
 		Returns the scrollbars object, whose visibility can be toggled in the window.
 		Returns the scrollbars object, whose visibility can be toggled in the window.
 	**/
 	**/
 	var scrollbars(default,null) : BarProp;
 	var scrollbars(default,null) : BarProp;
-	
+
 	/**
 	/**
 		Returns the statusbar object, whose visibility can be toggled in the window.
 		Returns the statusbar object, whose visibility can be toggled in the window.
 	**/
 	**/
 	var statusbar(default,null) : BarProp;
 	var statusbar(default,null) : BarProp;
-	
+
 	/**
 	/**
 		Returns the toolbar object, whose visibility can be toggled in the window.
 		Returns the toolbar object, whose visibility can be toggled in the window.
 	**/
 	**/
 	var toolbar(default,null) : BarProp;
 	var toolbar(default,null) : BarProp;
-	
+
 	/**
 	/**
 		Gets/sets the text in the statusbar at the bottom of the browser.
 		Gets/sets the text in the statusbar at the bottom of the browser.
 	**/
 	**/
 	var status : String;
 	var status : String;
-	
+
 	/**
 	/**
 		This property indicates whether the current window is closed or not.
 		This property indicates whether the current window is closed or not.
 	**/
 	**/
 	var closed(default,null) : Bool;
 	var closed(default,null) : Bool;
-	
+
 	/**
 	/**
 		Returns the current event, which is the event currently being handled by the JavaScript code's context, or `undefined` if no event is currently being handled. The `Event` object passed directly to event handlers should be used instead whenever possible.
 		Returns the current event, which is the event currently being handled by the JavaScript code's context, or `undefined` if no event is currently being handled. The `Event` object passed directly to event handlers should be used instead whenever possible.
 	**/
 	**/
 	var event(default,null) : Dynamic;
 	var event(default,null) : Dynamic;
-	
+
 	/**
 	/**
 		Returns an array of the subframes in the current window.
 		Returns an array of the subframes in the current window.
 	**/
 	**/
 	var frames(default,null) : Window;
 	var frames(default,null) : Window;
-	
+
 	/**
 	/**
 		Returns the number of frames in the window. See also `window.frames`.
 		Returns the number of frames in the window. See also `window.frames`.
 	**/
 	**/
 	var length(default,null) : Int;
 	var length(default,null) : Int;
-	
+
 	/**
 	/**
 		Returns a reference to the topmost window in the window hierarchy. This property is read only.
 		Returns a reference to the topmost window in the window hierarchy. This property is read only.
 	**/
 	**/
 	var top(default,null) : Window;
 	var top(default,null) : Window;
-	
+
 	/**
 	/**
 		Returns a reference to the window that opened this current window.
 		Returns a reference to the window that opened this current window.
 	**/
 	**/
 	var opener : Dynamic;
 	var opener : Dynamic;
-	
+
 	/**
 	/**
 		Returns a reference to the parent of the current window or subframe.
 		Returns a reference to the parent of the current window or subframe.
 	**/
 	**/
 	var parent(default,null) : Window;
 	var parent(default,null) : Window;
-	
+
 	/**
 	/**
 		Returns the element in which the window is embedded, or null if the window is not embedded.
 		Returns the element in which the window is embedded, or null if the window is not embedded.
 	**/
 	**/
 	var frameElement(default,null) : Element;
 	var frameElement(default,null) : Element;
-	
+
 	/**
 	/**
 		Returns a reference to the navigator object.
 		Returns a reference to the navigator object.
 	**/
 	**/
 	var navigator(default,null) : Navigator;
 	var navigator(default,null) : Navigator;
-	
+
 	/**
 	/**
 		Returns a reference to the console object which provides access to the browser's debugging console.
 		Returns a reference to the console object which provides access to the browser's debugging console.
 	**/
 	**/
 	var console(default,null) : ConsoleInstance;
 	var console(default,null) : ConsoleInstance;
-	
+
 	/**
 	/**
 		Returns a reference to the screen object associated with the window.
 		Returns a reference to the screen object associated with the window.
 	**/
 	**/
 	var screen(default,null) : Screen;
 	var screen(default,null) : Screen;
-	
+
 	/**
 	/**
 		Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.
 		Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.
 	**/
 	**/
 	var innerWidth : Dynamic;
 	var innerWidth : Dynamic;
-	
+
 	/**
 	/**
 		Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.
 		Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.
 	**/
 	**/
 	var innerHeight : Dynamic;
 	var innerHeight : Dynamic;
-	
+
 	/**
 	/**
 		Returns the number of pixels that the document has already been scrolled horizontally.
 		Returns the number of pixels that the document has already been scrolled horizontally.
 	**/
 	**/
 	var scrollX(default,null) : Float;
 	var scrollX(default,null) : Float;
-	
+
 	/**
 	/**
 		An alias for `window.scrollX`.
 		An alias for `window.scrollX`.
 	**/
 	**/
 	var pageXOffset(default,null) : Float;
 	var pageXOffset(default,null) : Float;
-	
+
 	/**
 	/**
 		Returns the number of pixels that the document has already been scrolled vertically.
 		Returns the number of pixels that the document has already been scrolled vertically.
 	**/
 	**/
 	var scrollY(default,null) : Float;
 	var scrollY(default,null) : Float;
-	
+
 	/**
 	/**
 		An alias for `window.scrollY`
 		An alias for `window.scrollY`
 	**/
 	**/
 	var pageYOffset(default,null) : Float;
 	var pageYOffset(default,null) : Float;
-	
+
 	/**
 	/**
 		Returns the horizontal distance of the left border of the user's browser from the left side of the screen.
 		Returns the horizontal distance of the left border of the user's browser from the left side of the screen.
 	**/
 	**/
 	var screenX : Dynamic;
 	var screenX : Dynamic;
-	
+
 	/**
 	/**
 		Returns the vertical distance of the top border of the user's browser from the top side of the screen.
 		Returns the vertical distance of the top border of the user's browser from the top side of the screen.
 	**/
 	**/
 	var screenY : Dynamic;
 	var screenY : Dynamic;
-	
+
 	/**
 	/**
 		Gets the width of the outside of the browser window.
 		Gets the width of the outside of the browser window.
 	**/
 	**/
 	var outerWidth : Dynamic;
 	var outerWidth : Dynamic;
-	
+
 	/**
 	/**
 		Gets the height of the outside of the browser window.
 		Gets the height of the outside of the browser window.
 	**/
 	**/
 	var outerHeight : Dynamic;
 	var outerHeight : Dynamic;
-	
+
 	/**
 	/**
 		Returns a `Performance` object, which includes the `Performance.timing` and `Performance.navigation` attributes, each of which is an object providing performance-related data. See also Using Navigation Timing for additional information and examples.
 		Returns a `Performance` object, which includes the `Performance.timing` and `Performance.navigation` attributes, each of which is an object providing performance-related data. See also Using Navigation Timing for additional information and examples.
 	**/
 	**/
 	var performance(default,null) : Performance;
 	var performance(default,null) : Performance;
-	
+
 	/**
 	/**
 		Returns the ratio between physical pixels and device independent pixels in the current display.
 		Returns the ratio between physical pixels and device independent pixels in the current display.
 	**/
 	**/
 	var devicePixelRatio(default,null) : Float;
 	var devicePixelRatio(default,null) : Float;
-	
+
 	/**
 	/**
 		The maximum offset that the window can be scrolled to horizontally, that is the document width minus the viewport width.
 		The maximum offset that the window can be scrolled to horizontally, that is the document width minus the viewport width.
 	**/
 	**/
 	var scrollMaxX(default,null) : Int;
 	var scrollMaxX(default,null) : Int;
-	
+
 	/**
 	/**
 		The maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height).
 		The maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height).
 	**/
 	**/
 	var scrollMaxY(default,null) : Int;
 	var scrollMaxY(default,null) : Int;
-	
+
 	/**
 	/**
 		This property indicates whether the window is displayed in full screen or not.
 		This property indicates whether the window is displayed in full screen or not.
 	**/
 	**/
@@ -234,18 +236,18 @@ extern class Window extends EventTarget {
 	var ondeviceproximity : haxe.Constraints.Function;
 	var ondeviceproximity : haxe.Constraints.Function;
 	var onuserproximity : haxe.Constraints.Function;
 	var onuserproximity : haxe.Constraints.Function;
 	var ondevicelight : haxe.Constraints.Function;
 	var ondevicelight : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		Returns a reference to the content element in the current window. Since Firefox 57 (initially Nightly-only), both versions are only available from chrome (privileged) code, and not available to the web anymore.
 		Returns a reference to the content element in the current window. Since Firefox 57 (initially Nightly-only), both versions are only available from chrome (privileged) code, and not available to the web anymore.
 	**/
 	**/
 	var content(default,null) : Dynamic;
 	var content(default,null) : Dynamic;
-	
+
 	/**
 	/**
 		Returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation.
 		Returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation.
 	**/
 	**/
 	var orientation(default,null) : Int;
 	var orientation(default,null) : Int;
 	var onorientationchange : haxe.Constraints.Function;
 	var onorientationchange : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		Returns the browser crypto object.
 		Returns the browser crypto object.
 	**/
 	**/
@@ -333,7 +335,7 @@ extern class Window extends EventTarget {
 	var onwebkitanimationstart : haxe.Constraints.Function;
 	var onwebkitanimationstart : haxe.Constraints.Function;
 	var onwebkittransitionend : haxe.Constraints.Function;
 	var onwebkittransitionend : haxe.Constraints.Function;
 	var onerror : haxe.extern.EitherType<Event,String> -> String -> Int -> Int -> Dynamic -> Dynamic;
 	var onerror : haxe.extern.EitherType<Event,String> -> String -> Int -> Int -> Dynamic -> Dynamic;
-	
+
 	/**
 	/**
 		Returns a `SpeechSynthesis` object, which is the entry point into using Web Speech API speech synthesis functionality.
 		Returns a `SpeechSynthesis` object, which is the entry point into using Web Speech API speech synthesis functionality.
 	**/
 	**/
@@ -356,207 +358,207 @@ extern class Window extends EventTarget {
 	var onpopstate : haxe.Constraints.Function;
 	var onpopstate : haxe.Constraints.Function;
 	var onstorage : haxe.Constraints.Function;
 	var onstorage : haxe.Constraints.Function;
 	var onunload : haxe.Constraints.Function;
 	var onunload : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		Returns a reference to the local storage object used to store data that may only be accessed by the origin that created it.
 		Returns a reference to the local storage object used to store data that may only be accessed by the origin that created it.
 	**/
 	**/
 	var localStorage(default,null) : Storage;
 	var localStorage(default,null) : Storage;
 	var origin(default,null) : String;
 	var origin(default,null) : String;
-	
+
 	/**
 	/**
 		Indicates whether a context is capable of using features that require secure contexts.
 		Indicates whether a context is capable of using features that require secure contexts.
 	**/
 	**/
 	var isSecureContext(default,null) : Bool;
 	var isSecureContext(default,null) : Bool;
 	var indexedDB(default,null) : js.html.idb.Factory;
 	var indexedDB(default,null) : js.html.idb.Factory;
 	var caches(default,null) : CacheStorage;
 	var caches(default,null) : CacheStorage;
-	
+
 	/**
 	/**
 		Returns a reference to the session storage object used to store data that may only be accessed by the origin that created it.
 		Returns a reference to the session storage object used to store data that may only be accessed by the origin that created it.
 	**/
 	**/
 	var sessionStorage(default,null) : Storage;
 	var sessionStorage(default,null) : Storage;
-	
-	
+
+
 	/**
 	/**
 		Closes the current window.
 		Closes the current window.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function close() : Void;
 	function close() : Void;
-	
+
 	/**
 	/**
 		This method stops window loading.
 		This method stops window loading.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function stop() : Void;
 	function stop() : Void;
-	
+
 	/**
 	/**
 		Sets focus on the current window.
 		Sets focus on the current window.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function focus() : Void;
 	function focus() : Void;
-	
+
 	/**
 	/**
 		Sets focus away from the window.
 		Sets focus away from the window.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function blur() : Void;
 	function blur() : Void;
-	
+
 	/**
 	/**
 		Opens a new window.
 		Opens a new window.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function open( url : String = "", target : String = "", features : String = "" ) : Window;
 	function open( url : String = "", target : String = "", features : String = "" ) : Window;
-	
+
 	/**
 	/**
 		Displays an alert dialog.
 		Displays an alert dialog.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	@:overload( function() : Void {} )
 	@:overload( function() : Void {} )
 	function alert( message : String ) : Void;
 	function alert( message : String ) : Void;
-	
+
 	/**
 	/**
 		Displays a dialog with a message that the user needs to respond to.
 		Displays a dialog with a message that the user needs to respond to.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function confirm( message : String = "" ) : Bool;
 	function confirm( message : String = "" ) : Bool;
-	
+
 	/**
 	/**
 		Returns the text entered by the user in a prompt dialog.
 		Returns the text entered by the user in a prompt dialog.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function prompt( message : String = "", default_ : String = "" ) : String;
 	function prompt( message : String = "", default_ : String = "" ) : String;
-	
+
 	/**
 	/**
 		Opens the Print Dialog to print the current document.
 		Opens the Print Dialog to print the current document.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function print() : Void;
 	function print() : Void;
-	
+
 	/**
 	/**
 		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.
 		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.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function postMessage( message : Dynamic, targetOrigin : String, ?transfer : Array<Dynamic> ) : Void;
 	function postMessage( message : Dynamic, targetOrigin : String, ?transfer : Array<Dynamic> ) : Void;
-	
+
 	/**
 	/**
 		Registers the window to capture all events of the specified type.
 		Registers the window to capture all events of the specified type.
 	**/
 	**/
 	function captureEvents() : Void;
 	function captureEvents() : Void;
-	
+
 	/**
 	/**
 		Releases the window from trapping events of a specific type.
 		Releases the window from trapping events of a specific type.
 	**/
 	**/
 	function releaseEvents() : Void;
 	function releaseEvents() : Void;
-	
+
 	/**
 	/**
 		Returns the selection object representing the selected item(s).
 		Returns the selection object representing the selected item(s).
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function getSelection() : Selection;
 	function getSelection() : Selection;
-	
+
 	/**
 	/**
 		Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.
 		Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function getComputedStyle( elt : Element, pseudoElt : String = "" ) : CSSStyleDeclaration;
 	function getComputedStyle( elt : Element, pseudoElt : String = "" ) : CSSStyleDeclaration;
-	
+
 	/**
 	/**
 		Returns a `MediaQueryList` object representing the specified media query string.
 		Returns a `MediaQueryList` object representing the specified media query string.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function matchMedia( query : String ) : MediaQueryList;
 	function matchMedia( query : String ) : MediaQueryList;
-	
+
 	/**
 	/**
 		Moves the window to the specified coordinates.
 		Moves the window to the specified coordinates.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function moveTo( x : Int, y : Int ) : Void;
 	function moveTo( x : Int, y : Int ) : Void;
-	
+
 	/**
 	/**
 		Moves the current window by a specified amount.
 		Moves the current window by a specified amount.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function moveBy( x : Int, y : Int ) : Void;
 	function moveBy( x : Int, y : Int ) : Void;
-	
+
 	/**
 	/**
 		Dynamically resizes window.
 		Dynamically resizes window.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function resizeTo( x : Int, y : Int ) : Void;
 	function resizeTo( x : Int, y : Int ) : Void;
-	
+
 	/**
 	/**
 		Resizes the current window by a certain amount.
 		Resizes the current window by a certain amount.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function resizeBy( x : Int, y : Int ) : Void;
 	function resizeBy( x : Int, y : Int ) : Void;
-	
+
 	/**
 	/**
 		Scrolls the window to a particular place in the document.
 		Scrolls the window to a particular place in the document.
 	**/
 	**/
 	@:overload( function( x : Float, y : Float ) : Void {} )
 	@:overload( function( x : Float, y : Float ) : Void {} )
 	function scroll( ?options : ScrollToOptions ) : Void;
 	function scroll( ?options : ScrollToOptions ) : Void;
-	
+
 	/**
 	/**
 		Scrolls to a particular set of coordinates in the document.
 		Scrolls to a particular set of coordinates in the document.
 	**/
 	**/
 	@:overload( function( x : Float, y : Float ) : Void {} )
 	@:overload( function( x : Float, y : Float ) : Void {} )
 	function scrollTo( ?options : ScrollToOptions ) : Void;
 	function scrollTo( ?options : ScrollToOptions ) : Void;
-	
+
 	/**
 	/**
 		Scrolls the document in the window by the given amount.
 		Scrolls the document in the window by the given amount.
 	**/
 	**/
 	@:overload( function( x : Float, y : Float ) : Void {} )
 	@:overload( function( x : Float, y : Float ) : Void {} )
 	function scrollBy( ?options : ScrollToOptions ) : Void;
 	function scrollBy( ?options : ScrollToOptions ) : Void;
-	
+
 	/**
 	/**
 		Tells the browser that an animation is in progress, requesting that the browser schedule a repaint of the window for the next animation frame.
 		Tells the browser that an animation is in progress, requesting that the browser schedule a repaint of the window for the next animation frame.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function requestAnimationFrame( callback : Float -> Void ) : Int;
 	function requestAnimationFrame( callback : Float -> Void ) : Int;
-	
+
 	/**
 	/**
 		Enables you to cancel a callback previously scheduled with `Window.requestAnimationFrame`.
 		Enables you to cancel a callback previously scheduled with `Window.requestAnimationFrame`.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function cancelAnimationFrame( handle : Int ) : Void;
 	function cancelAnimationFrame( handle : Int ) : Void;
-	
+
 	/**
 	/**
 		Gets default computed style for the specified element, ignoring author stylesheets.
 		Gets default computed style for the specified element, ignoring author stylesheets.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function getDefaultComputedStyle( elt : Element, pseudoElt : String = "" ) : CSSStyleDeclaration;
 	function getDefaultComputedStyle( elt : Element, pseudoElt : String = "" ) : CSSStyleDeclaration;
-	
+
 	/**
 	/**
 		Scrolls the document by the given number of lines.
 		Scrolls the document by the given number of lines.
 	**/
 	**/
 	function scrollByLines( numLines : Int, ?options : ScrollOptions ) : Void;
 	function scrollByLines( numLines : Int, ?options : ScrollOptions ) : Void;
-	
+
 	/**
 	/**
 		Scrolls the current document by the specified number of pages.
 		Scrolls the current document by the specified number of pages.
 	**/
 	**/
 	function scrollByPages( numPages : Int, ?options : ScrollOptions ) : Void;
 	function scrollByPages( numPages : Int, ?options : ScrollOptions ) : Void;
-	
+
 	/**
 	/**
 		Sizes the window according to its content.
 		Sizes the window according to its content.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function sizeToContent() : Void;
 	function sizeToContent() : Void;
-	
+
 	/**
 	/**
 		Updates the state of commands of the current chrome window (UI).
 		Updates the state of commands of the current chrome window (UI).
 	**/
 	**/
 	function updateCommands( action : String, ?sel : Selection, reason : Int = 0 ) : Void;
 	function updateCommands( action : String, ?sel : Selection, reason : Int = 0 ) : Void;
-	
+
 	/**
 	/**
 		Searches for a given string in a window.
 		Searches for a given string in a window.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function find( str : String = "", caseSensitive : Bool = false, backwards : Bool = false, wrapAround : Bool = false, wholeWord : Bool = false, searchInFrames : Bool = false, showDialog : Bool = false ) : Bool;
 	function find( str : String = "", caseSensitive : Bool = false, backwards : Bool = false, wrapAround : Bool = false, wholeWord : Bool = false, searchInFrames : Bool = false, showDialog : Bool = false ) : Bool;
-	
+
 	/**
 	/**
 		Writes a message to the console.
 		Writes a message to the console.
 	**/
 	**/
 	function dump( str : String ) : Void;
 	function dump( str : String ) : Void;
-	
+
 	/**
 	/**
 		Toggles a user's ability to resize a window.
 		Toggles a user's ability to resize a window.
 	**/
 	**/

+ 16 - 14
std/js/html/eme/MediaKeySession.hx

@@ -24,6 +24,8 @@
 
 
 package js.html.eme;
 package js.html.eme;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `MediaKeySession` interface of the EncryptedMediaExtensions API represents a context for message exchange with a content decryption module (CDM).
 	The `MediaKeySession` interface of the EncryptedMediaExtensions API represents a context for message exchange with a content decryption module (CDM).
 
 
@@ -34,62 +36,62 @@ package js.html.eme;
 @:native("MediaKeySession")
 @:native("MediaKeySession")
 extern class MediaKeySession extends js.html.EventTarget {
 extern class MediaKeySession extends js.html.EventTarget {
 	var error(default,null) : MediaKeyError;
 	var error(default,null) : MediaKeyError;
-	
+
 	/**
 	/**
 		Contains a unique string generated by the CDM for the current media object and its associated keys or licenses.
 		Contains a unique string generated by the CDM for the current media object and its associated keys or licenses.
 	**/
 	**/
 	var sessionId(default,null) : String;
 	var sessionId(default,null) : String;
-	
+
 	/**
 	/**
 		The time after which the keys in the current session can no longer be used to decrypt media data, or `NaN` if no such time exists. This value is determined by the CDM and measured in milliseconds since January 1, 1970, UTC. This value may change during a session lifetime, such as when an action triggers the start of a window.
 		The time after which the keys in the current session can no longer be used to decrypt media data, or `NaN` if no such time exists. This value is determined by the CDM and measured in milliseconds since January 1, 1970, UTC. This value may change during a session lifetime, such as when an action triggers the start of a window.
 	**/
 	**/
 	var expiration(default,null) : Float;
 	var expiration(default,null) : Float;
-	
+
 	/**
 	/**
 		Returns a `Promise` signaling when a `MediaKeySession` closes. This promise can only be fulfilled and is never rejected. Closing a session means that licenses and keys associated with it are no longer valid for decrypting media data. 
 		Returns a `Promise` signaling when a `MediaKeySession` closes. This promise can only be fulfilled and is never rejected. Closing a session means that licenses and keys associated with it are no longer valid for decrypting media data. 
 	**/
 	**/
 	var closed(default,null) : Promise<Void>;
 	var closed(default,null) : Promise<Void>;
-	
+
 	/**
 	/**
 		Contains a reference to a read-only `MediaKeyStatusMap` of the current session's keys and their statuses.
 		Contains a reference to a read-only `MediaKeyStatusMap` of the current session's keys and their statuses.
 	**/
 	**/
 	var keyStatuses(default,null) : MediaKeyStatusMap;
 	var keyStatuses(default,null) : MediaKeyStatusMap;
-	
+
 	/**
 	/**
 		Sets the `EventHandler` called when there has been a change in the keys in a session or their statuses.
 		Sets the `EventHandler` called when there has been a change in the keys in a session or their statuses.
 	**/
 	**/
 	var onkeystatuseschange : haxe.Constraints.Function;
 	var onkeystatuseschange : haxe.Constraints.Function;
-	
+
 	/**
 	/**
 		Sets the `EventHandler` called when the content decryption module has generated a message for the session.
 		Sets the `EventHandler` called when the content decryption module has generated a message for the session.
 	**/
 	**/
 	var onmessage : haxe.Constraints.Function;
 	var onmessage : haxe.Constraints.Function;
-	
-	
+
+
 	/**
 	/**
 		Returns a `Promise` after generating a media request based on initialization data.
 		Returns a `Promise` after generating a media request based on initialization data.
 	**/
 	**/
 	@:overload( function( initDataType : String, initData : js.lib.ArrayBuffer) : Promise<Void> {} )
 	@:overload( function( initDataType : String, initData : js.lib.ArrayBuffer) : Promise<Void> {} )
 	function generateRequest( initDataType : String, initData : js.lib.ArrayBufferView ) : Promise<Void>;
 	function generateRequest( initDataType : String, initData : js.lib.ArrayBufferView ) : Promise<Void>;
-	
+
 	/**
 	/**
 		Returns a `Promise` that resolves to a boolean value after loading data for a specified session object. 
 		Returns a `Promise` that resolves to a boolean value after loading data for a specified session object. 
 	**/
 	**/
 	function load( sessionId : String ) : Promise<Bool>;
 	function load( sessionId : String ) : Promise<Bool>;
-	
+
 	/**
 	/**
 		Returns a `Promise` after loading messages and licenses to the CDM.
 		Returns a `Promise` after loading messages and licenses to the CDM.
 	**/
 	**/
 	@:overload( function( response : js.lib.ArrayBuffer) : Promise<Void> {} )
 	@:overload( function( response : js.lib.ArrayBuffer) : Promise<Void> {} )
 	function update( response : js.lib.ArrayBufferView ) : Promise<Void>;
 	function update( response : js.lib.ArrayBufferView ) : Promise<Void>;
-	
+
 	/**
 	/**
-		
+
 		 Returns a `Promise` after notifying the current media session is no longer needed and that the CDM should release any resources associated with this object and close it.
 		 Returns a `Promise` after notifying the current media session is no longer needed and that the CDM should release any resources associated with this object and close it.
-		 
+
 	**/
 	**/
 	function close() : Promise<Void>;
 	function close() : Promise<Void>;
-	
+
 	/**
 	/**
 		Returns a `Promise` after removing any session data associated with the current object.
 		Returns a `Promise` after removing any session data associated with the current object.
 	**/
 	**/

+ 6 - 4
std/js/html/eme/MediaKeySystemAccess.hx

@@ -24,6 +24,8 @@
 
 
 package js.html.eme;
 package js.html.eme;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `MediaKeySystemAccess` interface of the EncryptedMediaExtensions API provides access to a Key System for decryption and/or a content protection provider. You can request an instance of this object using the `Navigator.requestMediaKeySystemAccess` method.
 	The `MediaKeySystemAccess` interface of the EncryptedMediaExtensions API provides access to a Key System for decryption and/or a content protection provider. You can request an instance of this object using the `Navigator.requestMediaKeySystemAccess` method.
 
 
@@ -33,18 +35,18 @@ package js.html.eme;
 **/
 **/
 @:native("MediaKeySystemAccess")
 @:native("MediaKeySystemAccess")
 extern class MediaKeySystemAccess {
 extern class MediaKeySystemAccess {
-	
+
 	/**
 	/**
 		Returns a `DOMString` identifying the key system being used.
 		Returns a `DOMString` identifying the key system being used.
 	**/
 	**/
 	var keySystem(default,null) : String;
 	var keySystem(default,null) : String;
-	
-	
+
+
 	/**
 	/**
 		Returns a `MediaKeySystemConfiguration` object with the supported combination of configuration options.
 		Returns a `MediaKeySystemConfiguration` object with the supported combination of configuration options.
 	**/
 	**/
 	function getConfiguration() : MediaKeySystemConfiguration;
 	function getConfiguration() : MediaKeySystemConfiguration;
-	
+
 	/**
 	/**
 		Returns a `Promise` that resolves to a new `MediaKeys` object.
 		Returns a `Promise` that resolves to a new `MediaKeys` object.
 	**/
 	**/

+ 5 - 3
std/js/html/eme/MediaKeys.hx

@@ -24,6 +24,8 @@
 
 
 package js.html.eme;
 package js.html.eme;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `MediaKeys` interface of EncryptedMediaExtensions API the represents a set of keys that an associated `HTMLMediaElement` can use for decryption of media data during playback.
 	The `MediaKeys` interface of EncryptedMediaExtensions API the represents a set of keys that an associated `HTMLMediaElement` can use for decryption of media data during playback.
 
 
@@ -34,14 +36,14 @@ package js.html.eme;
 @:native("MediaKeys")
 @:native("MediaKeys")
 extern class MediaKeys {
 extern class MediaKeys {
 	var keySystem(default,null) : String;
 	var keySystem(default,null) : String;
-	
-	
+
+
 	/**
 	/**
 		Returns a new `MediaKeySession` object, which represents a context for message exchange with a content decryption module (CDM).
 		Returns a new `MediaKeySession` object, which represents a context for message exchange with a content decryption module (CDM).
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function createSession( sessionType : MediaKeySessionType = TEMPORARY ) : MediaKeySession;
 	function createSession( sessionType : MediaKeySessionType = TEMPORARY ) : MediaKeySession;
-	
+
 	/**
 	/**
 		Returns a `Promise` to a server certificate to be used to encrypt messages to the license server.
 		Returns a `Promise` to a server certificate to be used to encrypt messages to the license server.
 	**/
 	**/

+ 5 - 3
std/js/html/push/PushManager.hx

@@ -24,6 +24,8 @@
 
 
 package js.html.push;
 package js.html.push;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `PushManager` interface of the Push API provides a way to receive notifications from third-party servers as well as request URLs for push notifications.
 	The `PushManager` interface of the Push API provides a way to receive notifications from third-party servers as well as request URLs for push notifications.
 
 
@@ -35,19 +37,19 @@ package js.html.push;
 extern class PushManager {
 extern class PushManager {
 	/** @throws DOMError */
 	/** @throws DOMError */
 	function new( scope : String ) : Void;
 	function new( scope : String ) : Void;
-	
+
 	/**
 	/**
 		Subscribes to a push service. It returns a `Promise` that resolves to a `PushSubscription` object containing details of a push subscription. A new push subscription is created if the current service worker does not have an existing subscription.
 		Subscribes to a push service. It returns a `Promise` that resolves to a `PushSubscription` object containing details of a push subscription. A new push subscription is created if the current service worker does not have an existing subscription.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function subscribe( ?options : PushSubscriptionOptionsInit ) : Promise<PushSubscription>;
 	function subscribe( ?options : PushSubscriptionOptionsInit ) : Promise<PushSubscription>;
-	
+
 	/**
 	/**
 		Retrieves an existing push subscription. It returns a `Promise` that resolves to a `PushSubscription` object containing details of an existing subscription. If no existing subscription exists, this resolves to a `null` value.
 		Retrieves an existing push subscription. It returns a `Promise` that resolves to a `PushSubscription` object containing details of an existing subscription. If no existing subscription exists, this resolves to a `null` value.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function getSubscription() : Promise<PushSubscription>;
 	function getSubscription() : Promise<PushSubscription>;
-	
+
 	/**
 	/**
 		Returns a `Promise` that resolves to the permission state of the current `PushManager`, which will be one of `'granted'`, `'denied'`, or `'prompt'`.
 		Returns a `Promise` that resolves to the permission state of the current `PushManager`, which will be one of `'granted'`, `'denied'`, or `'prompt'`.
 		@throws DOMError
 		@throws DOMError

+ 8 - 6
std/js/html/push/PushSubscription.hx

@@ -24,6 +24,8 @@
 
 
 package js.html.push;
 package js.html.push;
 
 
+import js.lib.Promise;
+
 /**
 /**
 	The `PushSubscription` interface of the Push API provides a subcription's URL endpoint and allows unsubscription from a push service.
 	The `PushSubscription` interface of the Push API provides a subcription's URL endpoint and allows unsubscription from a push service.
 
 
@@ -33,32 +35,32 @@ package js.html.push;
 **/
 **/
 @:native("PushSubscription")
 @:native("PushSubscription")
 extern class PushSubscription {
 extern class PushSubscription {
-	
+
 	/**
 	/**
 		A `USVString` containing the endpoint associated with the push subscription.
 		A `USVString` containing the endpoint associated with the push subscription.
 	**/
 	**/
 	var endpoint(default,null) : String;
 	var endpoint(default,null) : String;
-	
+
 	/**
 	/**
 		An object containing the options used to create the subscription.
 		An object containing the options used to create the subscription.
 	**/
 	**/
 	var options(default,null) : PushSubscriptionOptions;
 	var options(default,null) : PushSubscriptionOptions;
-	
+
 	/** @throws DOMError */
 	/** @throws DOMError */
 	function new( initDict : PushSubscriptionInit ) : Void;
 	function new( initDict : PushSubscriptionInit ) : Void;
-	
+
 	/**
 	/**
 		Returns an `ArrayBuffer` which contains the client's public key, which can then be sent to a server and used in encrypting push message data.
 		Returns an `ArrayBuffer` which contains the client's public key, which can then be sent to a server and used in encrypting push message data.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function getKey( name : PushEncryptionKeyName ) : js.lib.ArrayBuffer;
 	function getKey( name : PushEncryptionKeyName ) : js.lib.ArrayBuffer;
-	
+
 	/**
 	/**
 		Starts the asynchronous process of unsubscribing from the push service, returning a `Promise` that resolves to a `Boolean` when the current subscription is successfully unregistered.
 		Starts the asynchronous process of unsubscribing from the push service, returning a `Promise` that resolves to a `Boolean` when the current subscription is successfully unregistered.
 		@throws DOMError
 		@throws DOMError
 	**/
 	**/
 	function unsubscribe() : Promise<Bool>;
 	function unsubscribe() : Promise<Bool>;
-	
+
 	/**
 	/**
 		Standard serializer — returns a JSON representation of the subscription properties.
 		Standard serializer — returns a JSON representation of the subscription properties.
 		@throws DOMError
 		@throws DOMError

+ 6 - 6
std/js/Date.hx → std/js/lib/Date.hx

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (C)2005-2019 Haxe Foundation
+ * Copyright (C)2005-2018 Haxe Foundation
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * copy of this software and associated documentation files (the "Software"),
@@ -19,7 +19,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
-package js;
+package js.lib;
 
 
 import Date in HaxeDate;
 import Date in HaxeDate;
 
 
@@ -35,14 +35,14 @@ extern class Date
 	function new() : Void;
 	function new() : Void;
 
 
 	/**
 	/**
-		Cast Haxe's Date to js.Date.
+		Cast Haxe's Date to js.lib.Date.
 	**/
 	**/
-	static public inline function fromHaxeDate(date:HaxeDate):js.Date {
+	static public inline function fromHaxeDate(date:HaxeDate):js.lib.Date {
 		return cast date;
 		return cast date;
 	}
 	}
 
 
 	/**
 	/**
-		Cast js.Date to Haxe's Date.
+		Cast js.lib.Date to Haxe's Date.
 	**/
 	**/
 	static public inline function toHaxeDate(date:Date):HaxeDate {
 	static public inline function toHaxeDate(date:Date):HaxeDate {
 		return cast date;
 		return cast date;
@@ -282,4 +282,4 @@ extern class Date
 		Converts a date to a string using the UTC timezone.
 		Converts a date to a string using the UTC timezone.
 	**/
 	**/
 	function toUTCString() : String;
 	function toUTCString() : String;
-}
+}

+ 68 - 0
std/js/lib/Error.hx

@@ -0,0 +1,68 @@
+/*
+ * Copyright (C)2005-2018 Haxe Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+package js.lib;
+
+@:native("Error")
+extern class Error
+{
+	var message : String;
+	var name : String;
+	var stack(default,null) : String;
+
+	function new(?message : String) : Void;
+}
+
+@:native("EvalError")
+extern class EvalError extends Error
+{
+	function new(?message : String) : Void;
+}
+
+@:native("RangeError")
+extern class RangeError extends Error
+{
+	function new(?message : String) : Void;
+}
+
+@:native("ReferenceError")
+extern class ReferenceError extends Error
+{
+	function new(?message : String) : Void;
+}
+
+@:native("SyntaxError")
+extern class SyntaxError extends Error
+{
+	function new(?message : String) : Void;
+}
+
+@:native("TypeError")
+extern class TypeError extends Error
+{
+	function new(?message : String) : Void;
+}
+
+@:native("URIError")
+extern class URIError extends Error
+{
+	function new(?message : String) : Void;
+}

+ 51 - 0
std/js/lib/Function.hx

@@ -0,0 +1,51 @@
+/*
+ * Copyright (C)2005-2018 Haxe Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+package js.lib;
+
+import haxe.extern.Rest;
+
+@:native("Function")
+extern class Function {
+	/** Specifies the number of arguments expected by the function. **/
+	var length(default,never):Int;
+
+	/** The name of the function. **/
+	var name:String;
+
+	/** Creates a new Function object. **/
+	function new(arg:String, rest:Rest<String>);
+
+	/** Calls a function and sets its this to the provided value, arguments can be passed as an Array object. **/
+	function apply(thisArg:Dynamic, argsArray:Array<Dynamic>):Dynamic;
+
+	/** Calls (executes) a function and sets its this to the provided value, arguments can be passed as they are. **/
+	function call(thisArg:Dynamic, args:Rest<Dynamic>):Dynamic;
+
+	/**
+		Creates a new function which, when called, has its this set to the provided value,
+		with a given sequence of arguments preceding any provided when the new function was called.
+	**/
+	@:pure function bind(thisArg:Dynamic, args:Rest<Dynamic>):Function;
+
+	/** Returns a string representing the source code of the function. **/
+	@:pure function toString():String;
+}

+ 10 - 0
std/js/lib/Iterator.hx

@@ -0,0 +1,10 @@
+package js.lib;
+
+typedef Iterator<T> = {
+	function next():IteratorStep<T>;
+}
+
+typedef IteratorStep<T> = {
+	done:Bool,
+	?value:T
+}

+ 24 - 22
std/js/Map.hx → std/js/lib/Map.hx

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (C)2005-2019 Haxe Foundation
+ * Copyright (C)2005-2018 Haxe Foundation
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * copy of this software and associated documentation files (the "Software"),
@@ -19,32 +19,34 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
-package js;
+package js.lib;
+
+import js.lib.Iterator;
 
 
 /**
 /**
-	The (native) JavaScript Map object holds key-value pairs. 
+	The (native) JavaScript Map object holds key-value pairs.
 	Any value (both objects and primitive values) may be used as either a key
 	Any value (both objects and primitive values) may be used as either a key
 	or a value.
 	or a value.
-	
+
 	Documentation [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
 	Documentation [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
 **/
 **/
 @:native("Map")
 @:native("Map")
 extern class Map<K,V> {
 extern class Map<K,V> {
-	/** 
-		The number of key/value pairs in the `js.Map` object. 
+	/**
+		The number of key/value pairs in the `js.Map` object.
 	**/
 	**/
 	var size(default,null):Int;
 	var size(default,null):Int;
 
 
 	/**
 	/**
-		An Array or other iterable object whose elements are key-value pairs 
+		An Array or other iterable object whose elements are key-value pairs
 		(arrays with two elements, e.g. `[[ 1, 'one' ],[ 2, 'two' ]]`).
 		(arrays with two elements, e.g. `[[ 1, 'one' ],[ 2, 'two' ]]`).
-		Each key-value pair is added to the new `js.Map`; 
+		Each key-value pair is added to the new `js.Map`;
 		null values are treated as undefined.
 		null values are treated as undefined.
 	**/
 	**/
 	@:pure function new(?iterable:Any);
 	@:pure function new(?iterable:Any);
 
 
-	/** 
-		A boolean asserting whether a value has been associated to the key in 
+	/**
+		A boolean asserting whether a value has been associated to the key in
 		the `js.Map` object or not.
 		the `js.Map` object or not.
 	**/
 	**/
 	@:pure function has(key:K):Bool;
 	@:pure function has(key:K):Bool;
@@ -55,14 +57,14 @@ extern class Map<K,V> {
 	@:pure function get(key:K):Null<V>;
 	@:pure function get(key:K):Null<V>;
 
 
 	/**
 	/**
-		Sets the value for the key in the Map object. 
+		Sets the value for the key in the Map object.
 		Returns the `js.Map` object.
 		Returns the `js.Map` object.
 	**/
 	**/
 	function set(key:K, value:V):Map<K,V>;
 	function set(key:K, value:V):Map<K,V>;
 
 
 	/**
 	/**
 		Returns `true` if an element in the `js.Map` object existed and has been
 		Returns `true` if an element in the `js.Map` object existed and has been
-		removed, or `false` if the element does not exist. 
+		removed, or `false` if the element does not exist.
 		`has(key)` will return `false` afterwards.
 		`has(key)` will return `false` afterwards.
 	**/
 	**/
 	function delete(key:K):Bool;
 	function delete(key:K):Bool;
@@ -73,31 +75,31 @@ extern class Map<K,V> {
 	function clear():Void;
 	function clear():Void;
 
 
 	/**
 	/**
-		Calls `callback` once for each key-value pair present in the `js.Map` 
-		object, in insertion order. 
-		
+		Calls `callback` once for each key-value pair present in the `js.Map`
+		object, in insertion order.
+
 		If a `thisArg` parameter is provided to forEach, it will be used as the
 		If a `thisArg` parameter is provided to forEach, it will be used as the
 		`this` value for each callback.
 		`this` value for each callback.
 	**/
 	**/
 	function forEach(callback:(value:V, key:K, map:Map<K,V>)->Void, ?thisArg:Any):Void;
 	function forEach(callback:(value:V, key:K, map:Map<K,V>)->Void, ?thisArg:Any):Void;
 
 
 	/**
 	/**
-		Returns a new `JsIterator` object that contains the keys for each element 
+		Returns a new `Iterator` object that contains the keys for each element
 		in the `js.Map` object in insertion order.
 		in the `js.Map` object in insertion order.
 	**/
 	**/
-	function keys():JsIterator<K>;
+	function keys():Iterator<K>;
 
 
 	/**
 	/**
-		Returns a new `JsIterator` object that contains the values for each 
+		Returns a new `Iterator` object that contains the values for each
 		element in the `js.Map` object in insertion order.
 		element in the `js.Map` object in insertion order.
 	**/
 	**/
-	function values():JsIterator<V>;
+	function values():Iterator<V>;
 
 
 	/**
 	/**
-		Returns a new `JsIterator` object that contains an array of `MapEntry`
+		Returns a new `Iterator` object that contains an array of `MapEntry`
 		for each element in the `js.Map` object in insertion order.
 		for each element in the `js.Map` object in insertion order.
 	**/
 	**/
-	function entries():JsIterator<MapEntry<K,V>>;
+	function entries():Iterator<MapEntry<K,V>>;
 }
 }
 
 
 /**
 /**
@@ -108,4 +110,4 @@ abstract MapEntry<K,V>(Array<Any>) {
 	public var value(get,never):V;
 	public var value(get,never):V;
 	inline function get_key():K return this[0];
 	inline function get_key():K return this[0];
 	inline function get_value():V return this[1];
 	inline function get_value():V return this[1];
-}
+}

+ 224 - 0
std/js/lib/Object.hx

@@ -0,0 +1,224 @@
+/*
+ * Copyright (C)2005-2018 Haxe Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+package js.lib;
+
+import haxe.extern.Rest;
+import haxe.DynamicAccess;
+/**
+	The `js.lib.Object` constructor creates an object wrapper.
+
+	Documentation [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
+**/
+@:native("Object")
+extern class Object {
+	/**
+		Copies the values of all enumerable own properties from one or more
+		source objects to a target object.
+	**/
+	static function assign<T:{}>(target:T, sources:Rest<{}>):T;
+
+	/**
+		Creates a new object with the specified prototype object and properties.
+	**/
+	@:pure static function create<T>(proto:{}, ?propertiesObject:DynamicAccess<ObjectPropertyDescriptor>):T;
+
+	/**
+		Adds the named properties described by the given descriptors to an object.
+	**/
+	static function defineProperties<T:{}>(obj:T, props:DynamicAccess<ObjectPropertyDescriptor>):T;
+
+	/**
+		Adds the named property described by a given descriptor to an object.
+	**/
+	static function defineProperty<T:{}>(obj:T, prop:String, descriptor:ObjectPropertyDescriptor):T;
+
+	/**
+		Freezes an object: other code can't delete or change any properties.
+	**/
+	static function freeze<T:{}>(obj:T):T;
+
+	/**
+		Returns a property descriptor for a named property on an object.
+	**/
+	@:pure static function getOwnPropertyDescriptor(obj:{}, prop:String):Null<ObjectPropertyDescriptor>;
+
+	/**
+		Returns an array containing the names of all of the given object's own
+		enumerable and non-enumerable properties.
+	**/
+	@:pure static function getOwnPropertyNames(obj:{}):Array<String>;
+
+	/**
+		Returns an array of all symbol properties found directly upon a given object.
+	**/
+	@:pure static function getOwnPropertySymbols(obj:{}):Array<Symbol>;
+
+	/**
+		Returns the prototype of the specified object.
+	**/
+	@:pure static function getPrototypeOf<TProto:{}>(obj:{}):Null<TProto>;
+
+	/**
+		Compares if two values are the same value. Equates all NaN values
+		(which differs from both Abstract Equality Comparison and
+		Strict Equality Comparison).
+	**/
+	@:pure static function is<T>(value1:T, value2:T):Bool;
+
+	/**
+		Determines if extending of an object is allowed.
+	**/
+	@:pure static function isExtensible(obj:{}):Bool;
+
+	/**
+		Determines if an object was frozen.
+	**/
+	@:pure static function isFrozen(obj:{}):Bool;
+
+	/**
+		Determines if an object is sealed.
+	**/
+	@:pure static function isSealed(obj:{}):Bool;
+
+	/**
+		Returns an array containing the names of all of the given object's own
+		enumerable string properties.
+	**/
+	@:pure static function keys(obj:{}):Array<String>;
+
+	/**
+		Prevents any extensions of an object.
+	**/
+	static function preventExtensions<T:{}>(obj:T):T;
+
+	/**
+		Prevents other code from deleting properties of an object.
+	**/
+	static function seal<T:{}>(obj:T):T;
+
+	/**
+		Sets the prototype (i.e., the internal Prototype property).
+	**/
+	static function setPrototypeOf<T:{}>(obj:T, prototype:Null<{}>):T;
+
+	/**
+		Allows the addition of properties to all objects of type Object.
+	**/
+	static var prototype(default,never):ObjectPrototype;
+
+	/**
+		The Object constructor creates an object wrapper.
+	**/
+	@:pure function new(?value:Any);
+}
+
+/**
+	Type for
+	@see <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object>
+**/
+typedef ObjectPrototype = {
+	/**
+		Returns a boolean indicating whether an object contains the specified
+		property as a direct property of that object and not inherited through
+		the prototype chain.
+	**/
+	var hasOwnProperty(default,never):Function;
+
+	/**
+		Returns a boolean indicating whether the object this method is called
+		upon is in the prototype chain of the specified object.
+	**/
+	var isPrototypeOf(default,never):Function;
+
+	/**
+		Returns a boolean indicating if the internal enumerable attribute is set.
+	**/
+	var propertyIsEnumerable(default,never):Function;
+
+	/**
+		Calls `toString()`.
+	**/
+	var toLocaleString(default,never):Function;
+
+	/**
+		Returns a string representation of the object.
+	**/
+	var toString(default,never):Function;
+
+	/**
+		Returns the primitive value of the specified object.
+	**/
+	var valueOf(default,never):Function;
+}
+
+/**
+	@see <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty>
+**/
+typedef ObjectPropertyDescriptor = {
+	/**
+		`true` if and only if the type of this property descriptor may be
+		changed and if the property may be deleted from the corresponding object.
+
+		Defaults to `false`.
+	**/
+	var ?configurable:Bool;
+
+	/**
+		`true` if and only if this property shows up during enumeration of the
+		properties on the corresponding object.
+
+		Defaults to `false`.
+	**/
+	var ?enumerable:Bool;
+
+	/**
+		The value associated with the property.
+		Can be any valid JavaScript value (number, object, function, etc).
+	**/
+	var ?value:Any;
+
+	/**
+		`true` if and only if the value associated with the property may be
+		changed with an assignment operator.
+
+		Defaults to `false`.
+	**/
+	var ?writable:Bool;
+
+	/**
+		A function which serves as a getter for the property, or `undefined` if
+		there is no getter. When the property is accessed, this function is
+		called without arguments and with `this` set to the object through which
+		the property is accessed (this may not be the object on which the
+		property is defined due to inheritance).
+		The return value will be used as the value of the property.
+	**/
+	var ?get:Void->Any;
+
+	/**
+		A function which serves as a setter for the property, or undefined if
+		there is no setter. When the property is assigned to, this function
+		is called with one argument (the value being assigned to the property)
+		and with `this` set to the object through which the property is assigned.
+	**/
+	var ?set:Any->Void;
+}

+ 109 - 0
std/js/lib/Promise.hx

@@ -0,0 +1,109 @@
+/*
+ * Copyright (C)2005-2018 Haxe Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+package js.lib;
+
+import haxe.extern.EitherType;
+
+/**
+	The Promise object represents the eventual completion (or failure) of an
+	asynchronous operation and its resulting value.
+
+	Documentation [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
+**/
+@:native("Promise")
+extern class Promise<T>
+{
+	/**
+		Returns a Promise object that is resolved with the given value. If the
+		value is Thenable, the returned promise will "follow" that
+		thenable, adopting its eventual state;
+		otherwise the returned promise will be fulfilled with the value.
+		Generally, when it's unknown when value is a promise or not,
+		use `Promise.resolve(value)` instead and work with the return value as
+		a promise.
+	**/
+	@:overload(function<T>(?value : T) : Promise<T> {})
+	static function resolve<T>( thenable : Thenable<T> ) : Promise<T>;
+
+	/**
+		Returns a Promise object that is rejected with the given reason.
+	**/
+	static function reject<T>( ?reason : Dynamic ) : Promise<T>;
+
+	/**
+		Returns a promise that either fulfills when all of the promises in the
+		iterable argument have fulfilled or rejects as soon as one of the
+		promises in the iterable argument rejects. If the returned promise
+		fulfills, it is fulfilled with an array of the values from the
+		fulfilled promises in the same order as defined in the iterable.
+		If the returned promise rejects, it is rejected with the reason from
+		the first promise in the iterable that rejected. This method can be
+		useful for aggregating results of multiple promises.
+	**/
+	static function all( iterable : Array<Dynamic> ) : Promise<Array<Dynamic>>;
+
+	/**
+		Returns a promise that fulfills or rejects as soon as one of the
+		promises in the iterable fulfills or rejects, with the value or reason
+		from that promise.
+	**/
+	static function race( iterable : Array<Dynamic> ) : Promise<Dynamic>;
+
+	/** @throws DOMError */
+	function new( init : (resolve : (value : T) -> Void, reject: (reason : Dynamic) -> Void) -> Void ) : Void;
+
+	/**
+		Appends fulfillment and rejection handlers to the promise and returns a
+		new promise resolving to the return value of the called handler, or to
+		its original settled value if the promise was not handled
+		(i.e. if the relevant handler onFulfilled or onRejected is not a function).
+	**/
+	function then<TOut>( onFulfilled : Null<PromiseHandler<T, TOut>>, ?onRejected : PromiseHandler<Dynamic, TOut> ) : Promise<TOut>;
+
+	/**
+		Appends a rejection handler callback to the promise, and returns a new
+		promise resolving to the return value of the callback if it is called,
+		or to its original fulfillment value if the promise is instead fulfilled.
+	**/
+	@:native("catch")
+	function catchError<TOut>( onRejected : PromiseHandler<Dynamic, TOut> ) : Promise<TOut>;
+}
+
+/**
+	Handler type for the Promise object.
+**/
+abstract PromiseHandler<T,TOut>(T->Dynamic) // T->Dynamic, so the compiler always knows the type of the argument and can infer it for then/catch callbacks
+	from T->TOut // order is important, because Promise<TOut> return must have priority
+	from T->Thenable<TOut> // although the checking order seems to be reversed at the moment, see https://github.com/HaxeFoundation/haxe/issues/7656
+	from T->Promise<TOut> // support Promise explicitly as it doesn't work transitively through Thenable at the moment
+{}
+
+/**
+	A value with a `then` method.
+**/
+@:forward
+abstract Thenable<T>(ThenableStruct<T>) from ThenableStruct<T> {} // abstract wrapping prevents compiler hanging, see https://github.com/HaxeFoundation/haxe/issues/5785
+
+typedef ThenableStruct<T> = {
+	function then<TOut>( onFulfilled : Null<PromiseHandler<T, TOut>>, ?onRejected : PromiseHandler<Dynamic, TOut> ) : Thenable<TOut>;
+}

+ 46 - 0
std/js/lib/RegExp.hx

@@ -0,0 +1,46 @@
+/*
+ * Copyright (C)2005-2018 Haxe Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+ package js.lib;
+
+/**
+	Native JavaScript regular expressions.
+
+	For cross-platform regular expressions, use Haxe `EReg` class or
+	[regexp literals](https://haxe.org/manual/std-regex.html).
+**/
+@:native("RegExp")
+extern class RegExp {
+	var global(default,null):Bool;
+	var ignoreCase(default,null):Bool;
+	var multiline(default,null):Bool;
+	var source(default,null):String;
+	var lastIndex:Int;
+	function new(pattern:String, ?flags:String);
+	function exec(str:String):Null<RegExpMatch>;
+	function test(str:String):Bool;
+	function toString():String;
+}
+
+extern class RegExpMatch extends Array<String> {
+	var index:Int;
+	var input:String;
+}

+ 99 - 0
std/js/lib/Set.hx

@@ -0,0 +1,99 @@
+/*
+ * Copyright (C)2005-2018 Haxe Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+package js.lib;
+
+import js.lib.Map.MapEntry;
+import js.lib.Iterator;
+
+/**
+	The `js.Set` object lets you store unique values of any type, whether
+	primitive values or object references.
+
+	Documentation [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
+**/
+@:native("Set")
+extern class Set<T> {
+	/**
+		The number of values in the `js.Set` object.
+	**/
+	var size(default,null):Int;
+
+	/**
+		If an iterable object is passed, all of its elements will be added to
+		the new `js.Set`.
+	**/
+	@:pure function new(?iterable:Any);
+
+	/**
+		Returns a boolean asserting whether an element is present with the given
+		value in the `js.Set` object or not.
+	**/
+	@:pure function has(value:T):Bool;
+
+	/**
+		Appends a new element with the given value to the `js.Set` object.
+		Returns the `js.Set` object.
+	**/
+	function add(value:T):Set<T>;
+
+	/**
+		Removes the element associated to the value and returns the value that
+		`has(value)` would have previously returned.
+		`has(value)` will return `false` afterwards.
+	**/
+	function delete(value:T):Bool;
+
+	/**
+		Removes all elements from the `js.Set` object.
+	**/
+	function clear():Void;
+
+	/**
+		Calls `callback` once for each key-value pair present in the `js.Set`
+		object, in insertion order.
+
+		If a `thisArg` parameter is provided to forEach, it will be used as the
+		`this` value for each callback.
+	**/
+	function forEach(callback:(value:T, key:T, set:Set<T>)->Void, ?thisArg:Any):Void;
+
+	/**
+		Returns a new `js.lib.Iterator` object that contains the keys for each element
+		in the `js.Set` object in insertion order.
+	**/
+	function keys():Iterator<T>;
+
+	/**
+		Returns a new `js.lib.Iterator` object that contains the values for each
+		element in the `js.Set` object in insertion order.
+	**/
+	function values():Iterator<T>;
+
+	/**
+		Returns a new `js.lib.Iterator` object that contains an array of
+		`[value, value]` for each element in the `js.Set` object, in insertion
+		order.
+		This is kept similar to the `js.Map` object, so that each entry has the
+		same value for its key and value here.
+	**/
+	function entries():Iterator<MapEntry<T,T>>;
+}

+ 61 - 0
std/js/lib/Symbol.hx

@@ -0,0 +1,61 @@
+/*
+ * Copyright (C)2005-2018 Haxe Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+package js.lib;
+
+@:native("Symbol")
+extern class Symbol {
+	/**
+		To create a new primitive symbol, you write `new Symbol()` with an optional string as its `description`.
+
+		NOTE: Unlike plain JavaScript, in Haxe `new Symbol()` syntax is used, however `Symbol(...)` expression
+		will be generated as required by JavaScript specification.
+	**/
+	@:pure @:selfCall function new(?description:String);
+
+	/**
+		Searches for existing symbols with the given key and returns it if found.
+		Otherwise a new symbol gets created in the global symbol registry with this key.
+	**/
+	@:native("for") static function for_(key:String):Symbol;
+
+	/**
+		Retrieves a shared symbol key from the global symbol registry for the given symbol.
+	**/
+	@:pure static function keyFor(sym:Symbol):Null<String>;
+
+	/**
+		Returns a string containing the description of the Symbol.
+	**/
+	@:pure function toString():String;
+
+	/**
+		A method returning the default iterator for an object.
+	**/
+	static var iterator(default,null):Symbol;
+
+	/**
+		Retrieve symbol from a given `object`.
+
+		NOTE: This is a Haxe-specific method that generates `object[symbol]` expression.
+	**/
+	inline function ofObject<T>(object:{}):Null<T> return (cast object)[cast this];
+}

+ 4 - 2
tests/server/src/Vfs.hx

@@ -2,6 +2,8 @@ import js.node.Fs;
 import sys.FileSystem;
 import sys.FileSystem;
 import haxe.io.Path;
 import haxe.io.Path;
 
 
+using DateTools;
+
 class Vfs {
 class Vfs {
 	var physicalPath:String;
 	var physicalPath:String;
 
 
@@ -17,8 +19,8 @@ class Vfs {
 		var path = getPhysicalPath(path);
 		var path = getPhysicalPath(path);
 		FileSystem.createDirectory(path.dir);
 		FileSystem.createDirectory(path.dir);
 		var file = Fs.openSync(path.dir + "/" + path.file + "." + path.ext, 'a');
 		var file = Fs.openSync(path.dir + "/" + path.file + "." + path.ext, 'a');
-		var last = Date.fromString(Fs.fstatSync(file).mtime.toTimeString().substr(0, 8));
-		var notNow = js.Date.fromHaxeDate(DateTools.delta(last, 1000));
+		var last = Date.fromString(Fs.fstatSync(file).mtime.format("%T"));
+		var notNow = last.delta(1000);
 		Fs.futimesSync(file, notNow, notNow);
 		Fs.futimesSync(file, notNow, notNow);
 		Fs.closeSync(file);
 		Fs.closeSync(file);
 	}
 	}

+ 2 - 2
tests/unit/src/unit/issues/Issue3499.hx

@@ -2,7 +2,7 @@ package unit.issues;
 
 
 #if js
 #if js
 
 
-private typedef PathSimple = haxe.extern.EitherType<String,js.RegExp>;
+private typedef PathSimple = haxe.extern.EitherType<String,js.lib.RegExp>;
 private typedef Path = haxe.extern.EitherType<PathSimple,Array<PathSimple>>;
 private typedef Path = haxe.extern.EitherType<PathSimple,Array<PathSimple>>;
 
 
 #end
 #end
@@ -10,7 +10,7 @@ private typedef Path = haxe.extern.EitherType<PathSimple,Array<PathSimple>>;
 class Issue3499 extends Test {
 class Issue3499 extends Test {
 	#if js
 	#if js
 	function test() {
 	function test() {
-		var a:Path = ["", new js.RegExp("")];
+		var a:Path = ["", new js.lib.RegExp("")];
 		eq("", a[0]);
 		eq("", a[0]);
 	}
 	}
 	#end
 	#end

+ 1 - 1
tests/unit/src/unit/issues/Issue4644.hx

@@ -10,7 +10,7 @@ class Issue4644 extends Test {
 			}} catch (e) {{
 			}} catch (e) {{
 				{1} = (e instanceof {2});
 				{1} = (e instanceof {2});
 			}}",
 			}}",
-			throw (new js.Error() : Dynamic),
+			throw (new js.lib.Error() : Dynamic),
 			isHaxeError,
 			isHaxeError,
 			#if js_unflatten
 			#if js_unflatten
 			__js__("js._Boot.HaxeError")
 			__js__("js._Boot.HaxeError")