feat(facade): add read/write access to global variables

This commit is contained in:
Tobias Bosch 2015-05-28 14:55:10 -07:00
parent 75578f41e7
commit cdf791f0c5
2 changed files with 28 additions and 0 deletions

View File

@ -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);
}

View File

@ -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<any>) {
return fn.apply(self, args);
}