www: $off function is not explained

This issue has been tracked since 2022-11-19.

The data.$off function is never explained in the documentation

RafalKornel wrote this answer on 2022-11-19

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

kyfex-uwu wrote this answer on 2022-11-19

oh, sounds good! Hopefully it gets added to the website so new users don't have to dig through the tests

More Details About Repo
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

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date