diff --git a/modules/angular2/src/facade/js_interop.dart b/modules/angular2/src/facade/js_interop.dart new file mode 100644 index 0000000000..dd645b534d --- /dev/null +++ b/modules/angular2/src/facade/js_interop.dart @@ -0,0 +1,15 @@ +library angular2.src.facade.js_interop; + +import 'dart:js' as js; + +setGlobalVar(String name, value) { + js.context[name] = value; +} + +getGlobalVar(String name) { + return js.context[name]; +} + +invokeJsFunction(js.JsFunction fn, self, args) { + return fn.apply(args, thisArg: self); +} diff --git a/modules/angular2/src/facade/js_interop.ts b/modules/angular2/src/facade/js_interop.ts new file mode 100644 index 0000000000..38281485bc --- /dev/null +++ b/modules/angular2/src/facade/js_interop.ts @@ -0,0 +1,13 @@ +import {global} from './lang'; + +export function setGlobalVar(name: string, value: any) { + global[name] = value; +} + +export function getGlobalVar(name: string) { + return global[name]; +} + +export function invokeJsFunction(fn: Function, self: any, args: List) { + return fn.apply(self, args); +}