-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b4120b
commit 76367ee
Showing
1 changed file
with
6 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,13 @@ | ||
declare var global: any; | ||
|
||
const fableGlobal: { | ||
types: Map<string, FunctionConstructor>, | ||
symbols: { | ||
reflection: symbol, | ||
generics: symbol, | ||
} | ||
} = function () { | ||
const globalObj = | ||
typeof window !== "undefined" ? window | ||
: (typeof global !== "undefined" ? global | ||
: (typeof self !== "undefined" ? self : {})); | ||
if (typeof globalObj.__FABLE_CORE__ === "undefined") { | ||
globalObj.__FABLE_CORE__ = { | ||
types: new Map<string, FunctionConstructor>(), | ||
symbols: { | ||
reflection: Symbol("reflection"), | ||
} | ||
}; | ||
} | ||
return globalObj.__FABLE_CORE__; | ||
}(); | ||
const types = new Map<string, FunctionConstructor>(); | ||
|
||
export function setType(fullName: string, cons: FunctionConstructor) { | ||
fableGlobal.types.set(fullName, cons); | ||
types.set(fullName, cons); | ||
} | ||
|
||
export function getType(fullName: string) { | ||
return fableGlobal.types.get(fullName); | ||
return types.get(fullName); | ||
} | ||
|
||
export default (fableGlobal.symbols); | ||
export default { | ||
reflection: Symbol("reflection") | ||
} |