If you try to use this within methods called by {{on}} and {{fn}}, they show a helpful error instructing the developer to use the @action decorator. The render modifiers could show something like that too.
Here's an example "error" use case for did-insert:
<div class="my-container" {{did-insert this.renderEditor}}></div>
import Component from '@glimmer/component';
export default class CodeEditor extends Component {
renderEditor(el) {
console.log(this.args.code)
}
}
TypeError: this is undefined
{{fn}} uses this error message:
You accessed this.arg2 from a function passed to the fn helper, but the function itself was not bound to a valid this context. Consider updating to usage of @action.
If you try to use
thiswithin methods called by{{on}}and{{fn}}, they show a helpful error instructing the developer to use the@actiondecorator. The render modifiers could show something like that too.Here's an example "error" use case for
did-insert:{{fn}}uses this error message: