Browse Source

Add Browser.alert() as an easy replacement for Lib.alert().

Bruno Garcia 10 years ago
parent
commit
56f6e70eb9
2 changed files with 8 additions and 2 deletions
  1. 6 0
      std/js/Browser.hx
  2. 2 2
      std/js/Lib.hx

+ 6 - 0
std/js/Browser.hx

@@ -91,4 +91,10 @@ class Browser {
 		throw "Unable to create XMLHttpRequest object.";
 	}
 
+	/**
+		Display an alert message box containing the given message. See also `Window.alert()`.
+	**/
+	public static function alert( v : Dynamic ) {
+		@:privateAccess window.alert(Boot.__string_rec(v,""));
+	}
 }

+ 2 - 2
std/js/Lib.hx

@@ -32,9 +32,9 @@ class Lib {
 
 	/**
 		Display an alert message box containing the given message.
-		@deprecated Use Browser.window.alert() instead.
+		@deprecated Use Browser.alert() instead.
 	**/
-	@:deprecated("Lib.alert() is deprecated, use Browser.window.alert() instead")
+	@:deprecated("Lib.alert() is deprecated, use Browser.alert() instead")
 	public static function alert( v : Dynamic ) {
 		untyped __js__("alert")(js.Boot.__string_rec(v,""));
 	}