1let obj = encapsulatedObject || window;
2Object.defineProperty(obj, "myVar", {
3 configurable: true,
4 set(v){
5 Object.defineProperty(obj, "myVar", {
6 configurable: true, enumerable: true, writable: true, value: v });
7 console.log("window.myVar is defined");
8 }
9});