| // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| part of $LIBRARYNAME; |
| |
| $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| |
| /** |
| * Executes a [callback] after the immediate execution stack has completed. |
| * |
| * This will cause the callback to be executed after all processing has |
| * completed for the current event, but before any subsequent events. |
| */ |
| void setImmediate(TimeoutHandler callback) { |
| _addMicrotaskCallback(callback); |
| } |
| |
| /** |
| * Lookup a port by its [name]. Return null if no port is |
| * registered under [name]. |
| */ |
| 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. |
| */ |
| registerPort(String name, var port) { |
| var serialized = _serialize(port); |
| document.documentElement.attributes['dart-port:$name'] = json.stringify(serialized); |
| } |
| |
| /// Checks if _setImmediate is supported. |
| static bool get _supportsSetImmediate => false; |
| |
| /// Dartium stub for IE's setImmediate. |
| void _setImmediate(void callback()) { |
| throw new UnsupportedError('setImmediate is not supported'); |
| } |
| |
| $!MEMBERS |
| } |