The data.$off function is never explained in the documentation
Based on what I've found in tests:
// r.test.ts
it('can stop listening to changes', async () => {
const reactive = r({
foo: 'bar',
bar: 'foo',
})
const listener = jest.fn()
reactive.$on('bar', listener)
reactive.bar = 'baz'
await nextTick()
expect(listener.mock.calls.length).toBe(1)
reactive.$off('bar', listener)
reactive.bar = 'fizz'
await nextTick()
expect(listener.mock.calls.length).toBe(1)
})
It seems like $off
is analogous to removeEventListener
- method on HTMLElement
Owner Name | justin-schroeder |
Repo Name | arrow-js |
Full Name | justin-schroeder/arrow-js |
Language | TypeScript |
Created Date | 2022-11-08 |
Updated Date | 2023-03-28 |
Star Count | 1240 |
Watcher Count | 21 |
Fork Count | 22 |
Issue Count | 7 |
Issue Title | Created Date | Updated Date |
---|