main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
643 bytes
|
Line | |
---|
1 | const context = (() => {
|
---|
2 | if (typeof globalThis !== "undefined") {
|
---|
3 | return globalThis;
|
---|
4 | } else if (typeof self !== "undefined") {
|
---|
5 | return self;
|
---|
6 | } else if (typeof window !== "undefined") {
|
---|
7 | return window;
|
---|
8 | } else {
|
---|
9 | return Function("return this")();
|
---|
10 | }
|
---|
11 | })();
|
---|
12 | const defines = __DEFINES__;
|
---|
13 | Object.keys(defines).forEach((key) => {
|
---|
14 | const segments = key.split(".");
|
---|
15 | let target = context;
|
---|
16 | for (let i = 0; i < segments.length; i++) {
|
---|
17 | const segment = segments[i];
|
---|
18 | if (i === segments.length - 1) {
|
---|
19 | target[segment] = defines[key];
|
---|
20 | } else {
|
---|
21 | target = target[segment] || (target[segment] = {});
|
---|
22 | }
|
---|
23 | }
|
---|
24 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.