-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
this is not bound in created and destroyed, so it's hard to access custom context variables:
export class TestComponent extends Rete.Component {
constructor(foo) {
super("Test");
this.foo = foo;
}
created(node) {
console.log(`Created ${node.id} for ${this.foo}`); // Won't work, because `this` will be `undefined`
}
}The function hooks should be bound to the respective class instance.
Background
In my particular use-case, I'd like to have a context variable (equivalent to foo) point at a container DOM element and each node owns a DOM child that is attached to the container DOM element. However, during node creation / destruction I'm unable to find the container DOM element, because this is undefined.
Metadata
Metadata
Assignees
Labels
No labels