We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 70cec98 commit c863777Copy full SHA for c863777
1 file changed
src/NodeComponent.ts
@@ -33,6 +33,15 @@ export abstract class NodeComponent<T extends Node> {
33
this.node = node;
34
}
35
36
+ /**
37
+ * Run a function in the context of this component
38
+ * @param fn Provides this component as the first argument and `this`.
39
+ */
40
+ public context(fn: (this: this, component: this) => this): this {
41
+ fn.call(this, this);
42
+ return this;
43
+ }
44
+
45
/**
46
* Insert component after the last child
47
*/
0 commit comments