Evaluate lazily android specific global values

This commit is contained in:
Jason Zhekov
2016-04-20 17:21:29 +03:00
parent 615bbc9f2e
commit 826ab252e4
7 changed files with 55 additions and 36 deletions

4
utils/lazy.ts Normal file
View File

@@ -0,0 +1,4 @@
export default function lazy<T>(action: () => T): () => T {
let _value: T;
return () => _value || (_value = action());
}