-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New API methods including invalidate and custom roots #25
Conversation
@stefanpenner ^^^^^ |
d92c789
to
7f580ff
Compare
!Not ready to merge until a new release of Spaniel v2.5.0 is rolled out. |
01e2755
to
0c378eb
Compare
This PR is ready to merge. Spaniel v2.5.0 is released. |
addon/services/viewport.js
Outdated
spaniel.invalidate(); | ||
}, | ||
|
||
on(eventName, callback, root = window) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this API have to do with this service? it doesn't look like it belongs here at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention was succinct abstract event binding methods to be called on the ember-spaniel viewport directly with an argument to specify a root. The use-case is to call spaniel.invalidate()
. Im totally cool with removing on/off/onDebouce
from the API (this PR) and rather just documenting the implementation via leveraging existing API's.
The key changes are invalidate
and ALLOW_CACHED_SCHEDULER
.
Same answer for:
there is already a run.debounce util in ember itself. also, this doesn't not use anything in the service and does not seem like it has to do with spaniel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets pull on/off/onDebounce outside of this, just document suggested use of other apis. otherwise looks good to me
addon/services/viewport.js
Outdated
root.removeEventListener(eventName, callback, false); | ||
}, | ||
|
||
onDebounce(eventName, callback, interval, root = window) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is already a run.debounce util in ember itself. also, this doesn't not use anything in the service and does not seem like it has to do with spaniel.
This spike compliments (linkedin/spaniel#80). We will need to deploy this behind a minor version bump and feature flag.
This PR includes the following new API method:
invalidate
Additionally:
onInViewportOnce
and an optional flagALLOW_CACHED_SCHEDULER
.