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
(module | |
(import "imp" "log" (func $log (param i32 i32))) | |
(memory (import "imp" "mem") 1) | |
(func $writeHi | |
(i32.store8 | |
(i32.const 0) | |
(i32.const 72) | |
) | |
i32.const 0 | |
i32.const 5 |
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
var importObject = { | |
imports: { | |
imported_func: function(arg) { | |
console.log(arg); | |
} | |
} | |
}; | |
fetch('simple.wasm').then(response => | |
response.arrayBuffer() |
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
class A { | |
x = 0; | |
constructor() {} | |
} | |
class B extends A { | |
y = 10; | |
constructor() { | |
let t = _ => super(); t(); | |
} |
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
this.model.set({ attr: "foo" }); | |
this.model.attributes.attr = "foo"; | |
this.model.attr = "foo"; | |
$scope.prop = "foo"; | |
setTimeout(function () { | |
$scope.prop = "foo"; |
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
const onChange = value => console.log(value); | |
const proxy = new Proxy({}, { | |
set: function (target, propertyName, newValue) { | |
const oldName = Reflect.get(target, propertyName); | |
onChange({ propertyName, oldName, newValue }); | |
return Reflect.set(target, propertyName, newValue); | |
}, | |
deleteProperty: function (target, propertyName) { | |
onChange({ propertyName, oldValue: Reflect.get(target, propertyName) }); |
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
const obj = { id: "foo", name: "boo" }; | |
const proxy = new Proxy(obj, { | |
get: function (target, prop) { | |
console.log(`Access to property: ${prop}`); | |
return Reflect.get(target, prop); | |
} | |
}); | |
proxy.id; // Access to property: id |
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
const obj = {}; | |
const proxy = new Proxy(obj, { | |
set: function (target, prop, value) { | |
if (prop === "id" && value === undefined) | |
throw new Error("'undefined' is not allowed."); | |
Reflect.set(target, prop, value); | |
return true; | |
} | |
}); |
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
function getter () {} | |
const target = { id: "foo" }; | |
const proxy = new Proxy(target, { | |
get: getter | |
}); | |
console.log(proxy.id); |
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
var proxy = new Proxy({}, { | |
ownKeys: function () { | |
return [ null ]; | |
} | |
}); | |
Object.keys(proxy); // TypeError: null is not a valid property name |
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
const { proxy, revoke } = Proxy.revocable({ id: "foo"}, { | |
get: function(target, property) { | |
console.log(`get:${property}:${target[property]}`); | |
return target[property]; | |
} | |
}); | |
proxy.id; // get:id:foo | |
revoke(); | |
proxy.id; // TypeError: Cannot perform 'get' on a proxy that has been revoked |