mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 18:25:30 +00:00
Add delete opcode (#869)
This commit is contained in:
parent
59689fa827
commit
ceb85fa4be
2 changed files with 11 additions and 0 deletions
|
|
@ -323,6 +323,12 @@ export function* interpret(start, program, stack = []) {
|
|||
stack.push(klassInst);
|
||||
break;
|
||||
}
|
||||
// delete
|
||||
case 97: {
|
||||
const aValue = popStackValue();
|
||||
aValue.js_delete();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new Error(`Unhandled opcode ${command.opcode}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@ class MakiObject {
|
|||
this.children = this.children.filter(item => item !== child);
|
||||
}
|
||||
|
||||
js_delete() {
|
||||
this.parent.js_removeChild(this);
|
||||
this.parent.js_trigger("js_update");
|
||||
}
|
||||
|
||||
js_trigger(eventName, ...args) {
|
||||
this._emitter.trigger(eventName.toLowerCase(), ...args);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue