-
Notifications
You must be signed in to change notification settings - Fork 2.4k
How do you cancel job1 completely before its timeout value occur? #847
Comments
We need to document this method: #848 |
Let say you have a hover in and hover out where the hover toaster get a delay before it disappears after a hover out. But when you hover back in quick enough you need to cancel that job of disappearing. The thing about |
Currently I do it like this in: function (e){
this.cancel=true
document.querySelector('my-hover').fire('my-hover-in', {'title': title})
},
out: function (e){
this.cancel=false
this.job('myJob', function() {
if (this.cancel) return 0
document.querySelector('my-hover').fire('my-hover-out')
}, 500);
}, But this would be nicer in: function (e){
this.jobCancel('myJob')
document.querySelector('my-hover').fire('my-hover-in', {'title': title})
},
out: function (e){
this.job('myJob', function() {
document.querySelector('my-hover').fire('my-hover-out')
}, 500);
}, |
A little code poking reveals an alternate way of invoking job, using a job handle instead of a string. You can use the handle to stop the job, like this: this.myjob = this.job(this.myjob, function); Big caveat -- this syntax may be deprecated: https://github.com/Polymer/polymer/blob/87b3815812aaa9f956f044e74d43460b1babee5f/src/instance/base.js#L52 It would be pretty trivial to add a cancelJob method. What say you, @sjmiles ? |
Great thanks, I would never tought of that PS Actually I would deprecate this part haha :)
not the following part because it is nicer and does not mess with polymer internals. return Polymer.job.call(this, job, callback, wait); |
This issue has gone stale. Marking as obsolete. |
I am happy the github issues are getting cleaned up. I know you all have things to do and I also know allot of them are invalid, but still every open issue is a frustrated user and every polymer team member should know that even if it is not there fault. |
Talked to core folks. I'm going to re-open and move this to Polymer/polymer as an 0.8 feature request. |
This issue was moved to Polymer/polymer#1374 |
https://www.polymer-project.org/docs/polymer/polymer.html#job
The text was updated successfully, but these errors were encountered: