Skip to content

Commit cdf791f

Browse files
committed
feat(facade): add read/write access to global variables
1 parent 75578f4 commit cdf791f

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
library angular2.src.facade.js_interop;
2+
3+
import 'dart:js' as js;
4+
5+
setGlobalVar(String name, value) {
6+
js.context[name] = value;
7+
}
8+
9+
getGlobalVar(String name) {
10+
return js.context[name];
11+
}
12+
13+
invokeJsFunction(js.JsFunction fn, self, args) {
14+
return fn.apply(args, thisArg: self);
15+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import {global} from './lang';
2+
3+
export function setGlobalVar(name: string, value: any) {
4+
global[name] = value;
5+
}
6+
7+
export function getGlobalVar(name: string) {
8+
return global[name];
9+
}
10+
11+
export function invokeJsFunction(fn: Function, self: any, args: List<any>) {
12+
return fn.apply(self, args);
13+
}

0 commit comments

Comments
 (0)