| Index: sdk/lib/html/dart2js/html_dart2js.dart
|
| diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
|
| index 2300ddb9ea7f97e6a15384de5c08ec2114c9462f..198a688c273fdb1b0ca9c80e8086e2d60e81277d 100644
|
| --- a/sdk/lib/html/dart2js/html_dart2js.dart
|
| +++ b/sdk/lib/html/dart2js/html_dart2js.dart
|
| @@ -26516,6 +26516,59 @@ class WheelEvent extends MouseEvent native "*WheelEvent" {
|
| @DomName('Window')
|
| class Window extends EventTarget implements WindowBase native "@*DOMWindow" {
|
|
|
| + /**
|
| + * Returns a Future that will complete when the immediate execution stack has
|
| + * completed.
|
| + *
|
| + * This differs from using Timer(const Duration(milliseconds: 0), callback)
|
| + * because Timer will run in about 4-15 milliseconds, depending on browser,
|
| + * depending on load. [immediate], in contrast, performs makes
|
| + * browser-specific changes to attempt to run immediately after the current
|
| + * frame unwinds, causing the future to complete after all processing has
|
| + * completed for the current event, but before any subsequent events.
|
| + */
|
| + Future get immediate {
|
| + var completer = new Completer<int>();
|
| + _addMicrotaskCallback(() { completer.complete(); });
|
| + return completer.future;
|
| + }
|
| + /**
|
| + * Lookup a port by its [name]. Return null if no port is
|
| + * registered under [name].
|
| + */
|
| + SendPortSync lookupPort(String name) {
|
| + var port =
|
| + json.parse(document.documentElement.attributes['dart-port:$name']);
|
| + return _deserialize(port);
|
| + }
|
| +
|
| + /**
|
| + * Register a [port] on this window under the given [name]. This
|
| + * port may be retrieved by any isolate (or JavaScript script)
|
| + * running in this window.
|
| + */
|
| + void registerPort(String name, var port) {
|
| + var serialized = _serialize(port);
|
| + document.documentElement.attributes['dart-port:$name'] =
|
| + json.stringify(serialized);
|
| + }
|
| +
|
| + /**
|
| + * Returns a Future that completes just before the window is about to repaint
|
| + * so the user can draw an animation frame
|
| + *
|
| + * If you need to later cancel this animation, use [requestAnimationFrame]
|
| + * instead.
|
| + *
|
| + * Note: The code that runs when the future completes should call
|
| + * [animationFrame] again for the animation to continue.
|
| + */
|
| + Future<int> get animationFrame {
|
| + var completer = new Completer<int>();
|
| + requestAnimationFrame((scheduledTime) {completer.complete(scheduledTime);});
|
| + return completer.future;
|
| + }
|
| +
|
| Document get document => JS('Document', '#.document', this);
|
|
|
| WindowBase _open2(url, name) => JS('Window', '#.open(#,#)', this, url, name);
|
| @@ -26581,15 +26634,21 @@ class Window extends EventTarget implements WindowBase native "@*DOMWindow" {
|
| }
|
|
|
| /**
|
| - * Executes a [callback] after the immediate execution stack has completed.
|
| + * Called to draw an animation frame and then request the window to repaint
|
| + * after [callback] has finished (creating the animation).
|
| *
|
| - * This will cause the callback to be executed after all processing has
|
| - * completed for the current event, but before any subsequent events.
|
| + * Use this method only if you need to later call [cancelAnimationFrame]. If
|
| + * not, the preferred Dart idiom is to set animation frames by calling
|
| + * [animationFrame], which returns a Future.
|
| + *
|
| + * Returns a non-zero valued integer to represent the request id for this
|
| + * request. This value only needs to be saved if you intend to call
|
| + * [cancelAnimationFrame] so you can specify the particular animation to
|
| + * cancel.
|
| + *
|
| + * Note: The supplied [callback] needs to call [requestAnimationFrame] again
|
| + * for the animation to continue.
|
| */
|
| - void setImmediate(TimeoutHandler callback) {
|
| - _addMicrotaskCallback(callback);
|
| - }
|
| -
|
| @DomName('DOMWindow.requestAnimationFrame')
|
| int requestAnimationFrame(RequestAnimationFrameCallback callback) {
|
| _ensureRequestAnimationFrame();
|
| @@ -26648,25 +26707,6 @@ class Window extends EventTarget implements WindowBase native "@*DOMWindow" {
|
| '#.indexedDB || #.webkitIndexedDB || #.mozIndexedDB',
|
| this, this, this);
|
|
|
| - /**
|
| - * Lookup a port by its [name]. Return null if no port is
|
| - * registered under [name].
|
| - */
|
| - SendPortSync lookupPort(String name) {
|
| - var port = json.parse(document.documentElement.attributes['dart-port:$name']);
|
| - return _deserialize(port);
|
| - }
|
| -
|
| - /**
|
| - * Register a [port] on this window under the given [name]. This
|
| - * port may be retrieved by any isolate (or JavaScript script)
|
| - * running in this window.
|
| - */
|
| - void registerPort(String name, var port) {
|
| - var serialized = _serialize(port);
|
| - document.documentElement.attributes['dart-port:$name'] = json.stringify(serialized);
|
| - }
|
| -
|
| @DomName('Window.console')
|
| Console get console => Console.safeConsole;
|
|
|
| @@ -26978,14 +27018,6 @@ class Window extends EventTarget implements WindowBase native "@*DOMWindow" {
|
| @DocsEditable
|
| void captureEvents() native;
|
|
|
| - @DomName('DOMWindow.clearInterval')
|
| - @DocsEditable
|
| - void clearInterval(int handle) native;
|
| -
|
| - @DomName('DOMWindow.clearTimeout')
|
| - @DocsEditable
|
| - void clearTimeout(int handle) native;
|
| -
|
| @DomName('DOMWindow.close')
|
| @DocsEditable
|
| void close() native;
|
| @@ -27094,14 +27126,6 @@ class Window extends EventTarget implements WindowBase native "@*DOMWindow" {
|
| @DocsEditable
|
| void scrollTo(int x, int y) native;
|
|
|
| - @DomName('DOMWindow.setInterval')
|
| - @DocsEditable
|
| - int setInterval(TimeoutHandler handler, int timeout) native;
|
| -
|
| - @DomName('DOMWindow.setTimeout')
|
| - @DocsEditable
|
| - int setTimeout(TimeoutHandler handler, int timeout) native;
|
| -
|
| @DomName('DOMWindow.showModalDialog')
|
| @DocsEditable
|
| Object showModalDialog(String url, [Object dialogArgs, String featureArgs]) native;
|
| @@ -32542,7 +32566,7 @@ class _MutationObserverScheduler extends _MicrotaskScheduler {
|
| }
|
|
|
| /**
|
| - * Scheduler which uses window.setImmediate to schedule events.
|
| + * Scheduler which uses window.immediate to schedule events.
|
| */
|
| class _SetImmediateScheduler extends _MicrotaskScheduler {
|
| _SetImmediateScheduler(_MicrotaskCallback callback): super(callback);
|
|
|