OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 part of $LIBRARYNAME; |
| 6 |
| 7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 8 |
| 9 /** |
| 10 * Executes a [callback] after the immediate execution stack has completed. |
| 11 * |
| 12 * This will cause the callback to be executed after all processing has |
| 13 * completed for the current event, but before any subsequent events. |
| 14 */ |
| 15 void setImmediate(TimeoutHandler callback) { |
| 16 _addMicrotaskCallback(callback); |
| 17 } |
| 18 |
| 19 /** |
| 20 * Lookup a port by its [name]. Return null if no port is |
| 21 * registered under [name]. |
| 22 */ |
| 23 lookupPort(String name) { |
| 24 var port = json.parse(document.documentElement.attributes['dart-port:$name']
); |
| 25 return _deserialize(port); |
| 26 } |
| 27 |
| 28 /** |
| 29 * Register a [port] on this window under the given [name]. This |
| 30 * port may be retrieved by any isolate (or JavaScript script) |
| 31 * running in this window. |
| 32 */ |
| 33 registerPort(String name, var port) { |
| 34 var serialized = _serialize(port); |
| 35 document.documentElement.attributes['dart-port:$name'] = json.stringify(seri
alized); |
| 36 } |
| 37 |
| 38 /// Checks if _setImmediate is supported. |
| 39 static bool get _supportsSetImmediate => false; |
| 40 |
| 41 /// Dartium stub for IE's setImmediate. |
| 42 void _setImmediate(void callback()) { |
| 43 throw new UnsupportedError('setImmediate is not supported'); |
| 44 } |
| 45 |
| 46 $!MEMBERS |
| 47 } |
OLD | NEW |