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 // Top-level native code needed by the frog compiler |
| 6 |
| 7 var $globalThis = this; |
| 8 var $globals = null; |
| 9 var $globalState = null; |
| 10 |
| 11 // Wrap a 0-arg dom-callback to bind it with the current isolate: |
| 12 function $wrap_call$0(fn) { return fn && fn.wrap$call$0(); } |
| 13 |
| 14 Function.prototype.wrap$call$0 = function() { |
| 15 var isolateContext = $globalState.currentContext; |
| 16 var self = this; |
| 17 this.wrap$0 = function() { |
| 18 isolateContext.eval(self); |
| 19 $globalState.topEventLoop.run(); |
| 20 }; |
| 21 this.wrap$call$0 = function() { return this.wrap$0; }; |
| 22 return this.wrap$0; |
| 23 }; |
| 24 |
| 25 // Wrap a 1-arg dom-callback to bind it with the current isolate: |
| 26 function $wrap_call$1(fn) { return fn && fn.wrap$call$1(); } |
| 27 |
| 28 Function.prototype.wrap$call$1 = function() { |
| 29 var isolateContext = $globalState.currentContext; |
| 30 var self = this; |
| 31 this.wrap$1 = function(arg) { |
| 32 isolateContext.eval(function() { self(arg); }); |
| 33 $globalState.topEventLoop.run(); |
| 34 }; |
| 35 this.wrap$call$1 = function() { return this.wrap$1; }; |
| 36 return this.wrap$1; |
| 37 }; |
OLD | NEW |