Created
December 28, 2019 23:43
-
-
Save dckc/15291a3568cf5c5276278fe2929cfded to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* global Compartment, trace */ | |
export default function main() { | |
let g1Value = 'g1 original value'; | |
const g1Slot = { | |
get p1() { | |
trace(`getting g1: ${g1Value}\n`); | |
return g1Value; | |
}, | |
set p1(v) { | |
trace(`setting g1: ${g1Value} -> ${v}\n`); | |
g1Value = v; | |
}, | |
}; | |
const c1 = new Compartment("mod", { g1Slot }); | |
} |
This file contains hidden or 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
{ | |
"include": "$(MODDABLE)/examples/manifest_base.json", | |
"modules": { | |
"*": [ | |
"./main", | |
"./mod", | |
], | |
}, | |
"preload": [ | |
], | |
} |
This file contains hidden or 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
trace(globalThis.g1Slot.p1 + '\n'); | |
globalThis.g1Slot.p1 = 'new value'; | |
trace('mod done.\n'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LOG: