Skip to content

Commit 0ecbebc

Browse files
committed
wip
1 parent be21ff6 commit 0ecbebc

File tree

3 files changed

+1
-77
lines changed

3 files changed

+1
-77
lines changed

jscomp/runtime/caml_external_polyfill.res

+1-26
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,5 @@
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
2424

25-
type global
26-
let getGlobalThis: (. unit) => global = %raw(` function(){
27-
if (typeof globalThis !== 'undefined') return globalThis;
28-
if (typeof self !== 'undefined') return self;
29-
if (typeof window !== 'undefined') return window;
30-
if (typeof global !== 'undefined') return global;
31-
if (typeof this !== 'undefined') return this;
32-
throw new Error('Unable to locate global this');
33-
}`)
34-
3525
type dyn
36-
let resolve: (. string) => dyn = %raw(`function(s){
37-
var myGlobal = getGlobalThis();
38-
if (myGlobal[s] === undefined){
39-
throw new Error(s + " not polyfilled by ReScript yet\n")
40-
}
41-
return myGlobal[s]
42-
}`)
43-
44-
/* FIXME: it does not have to global states */
45-
type fn
46-
47-
let register: (string, fn) => unit = %raw(` function(s,fn){
48-
var myGlobal = getGlobalThis();
49-
myGlobal[s] = fn
50-
return 0
51-
}`)
26+
let resolve: string => dyn = %raw(`(s) => globalThis[s]`)

jscomp/test/external_polyfill_test.js

-34
This file was deleted.

jscomp/test/external_polyfill_test.res

-17
This file was deleted.

0 commit comments

Comments
 (0)