mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +08:00
* Expand static three.js workflows and host integration * Preserve JavaScript class state in static three.js workflows * Preserve inferred JavaScript behavior across static workflows * Preserve inferred callables and native compatibility boundaries * Retain annotated JavaScript factory exports and bootstrap-safe call spreads * Preserve Buffer and child callback identities in static packages * Clarify JavaScript symbol spread support
15 lines
485 B
JavaScript
15 lines
485 B
JavaScript
class Widget {
|
|
work(value) { return this.base + value; }
|
|
constructor() { this.base = 10; }
|
|
}
|
|
const first = new Widget(), second = new Widget();
|
|
function replace() {
|
|
first.work = function (value) { return this.base * value; };
|
|
return 2;
|
|
}
|
|
console.log(first.work(replace()), first.work(3), second.work(4));
|
|
first.work = 1;
|
|
second.work = 2;
|
|
try { first.work(0); } catch (error) { console.log(error.message); }
|
|
try { second.work(0); } catch (error) { console.log(error.message); }
|