ember-lifeline icon indicating copy to clipboard operation
ember-lifeline copied to clipboard

Assertion in `addEventListener` does not line up with what is advertised in the docs

Open sclaxton opened this issue 6 years ago • 1 comments

https://github.com/ember-lifeline/ember-lifeline/blob/803117c4b6899f181186d694e8749ec414956b8b/addon/dom-event-listeners.ts#L99

This assertion seems to assert that the second argument must be a DOM element and not a string, etc. However, this is not in line with the current docs:

addEventListener will provide the runloop and remove the listener when destroy is called, provided runDisposables is called. addEventListener provides several ways to specify an element:

addEventListener(this, '.someClass', 'scroll', fn);

// Attach to the component's element itself
addEventListener(this, 'scroll', fn);

// Attach to a DOM node
addEventListener(this, document.body, 'click', fn);

// Attach to window
addEventListener(this, window, 'scroll', fn);```

sclaxton avatar Dec 04 '19 20:12 sclaxton

Yep, definitely out of whack here thanks for reporting! Mind sending a PR in for the README update?

rwjblue avatar Dec 04 '19 23:12 rwjblue