feat(facade): add read/write access to global variables
This commit is contained in:
parent
75578f41e7
commit
cdf791f0c5
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue