onmount
Version:
Run something when a DOM element appears and when it exits
15 lines (10 loc) • 441 B
Markdown
Some recommend [using the role attribute][rsjs] to bind your behaviors. To aid this, you can define behaviors as `@xxxx`, which is shorthand of `[role~="xxxx"]`. (This convention is taken from [jquery-role].)
```js
$.onmount('@hiding-menu', function () {
/* ... */
})
/* same as $.onmount('[role~="hiding-menu"]', ...) */
```
[]: https://github.com/rstacruz/rsjs
[]: https://github.com/kossnocorp/role