UNPKG

bs-platform

Version:

bucklescript compiler, ocaml standard libary by bucklescript and its required runtime support

31 lines (25 loc) 750 B
'use strict'; function getGlobalThis (){ if (typeof globalThis !== 'undefined') return globalThis; if (typeof self !== 'undefined') return self; if (typeof window !== 'undefined') return window; if (typeof global !== 'undefined') return global; if (typeof this !== 'undefined') return this; throw new Error('Unable to locate global `this`'); }; function resolve (s){ var myGlobal = getGlobalThis(); if (myGlobal[s] === undefined){ throw new Error(s + " not polyfilled by BuckleScript yet\n") } return myGlobal[s] }; function register (s,fn){ var myGlobal = getGlobalThis(); myGlobal[s] = fn return 0 }; exports.getGlobalThis = getGlobalThis; exports.resolve = resolve; exports.register = register; /* No side effect */