@rescript/std
Version:
The motiviation of this repo is that when ReScript users want to share their library with JS users, the JS users don't need have ReScript toolchain installed, this makes sharing code with JS users easier (more details on that topic can be found in our [Ex
33 lines (26 loc) • 711 B
JavaScript
var getGlobalThis = (function(){
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');
});
var resolve = (function(s){
var myGlobal = getGlobalThis();
if (myGlobal[s] === undefined){
throw new Error(s + " not polyfilled by ReScript yet\n")
}
return myGlobal[s]
});
var register = (function(s,fn){
var myGlobal = getGlobalThis();
myGlobal[s] = fn
return 0
});
export {
getGlobalThis ,
resolve ,
register ,
}
/* No side effect */