You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be cool to be able to set an attribute for an infinite duration to use the paper-toast for things like showing a terms and cookie policy link on a site, shown here which can't go away until it is closed by the user.
You can already just put in a huge wait so it's necessary, It would just be cool.
Maybe something like
<paper-toast permanent></paper-toast>
or even possible
<paper-toast wait="0"></paper-toast>
I'm not sure what actually happens when you put a wait time of '0', except it calls debounce with a wait of '0' which calls async with a wait time of '0'
Polymer.Async={_currVal: 0,_lastVal: 0,_callbacks: [],_twiddleContent: 0,_twiddle: document.createTextNode(''),run: function(callback,waitTime){//- if (waitTime === 0) possibly just return so the function never gets runif(waitTime>0){//- Not relevant to this issue, but what does the ~ do to the return value of setTimeout?return~setTimeout(callback,waitTime);}else{this._twiddle.textContent=this._twiddleContent++;this._callbacks.push(callback);returnthis._currVal++;}},cancel: function(handle){if(handle<0){clearTimeout(~handle);}else{varidx=handle-this._lastVal;if(idx>=0){if(!this._callbacks[idx]){throw'invalid async handle: '+handle;}this._callbacks[idx]=null;}}},_atEndOfMicrotask: function(){varlen=this._callbacks.length;for(vari=0;i<len;i++){varcb=this._callbacks[i];if(cb){try{cb();}catch(e){i++;this._callbacks.splice(0,i);this._lastVal+=i;this._twiddle.textContent=this._twiddleContent++;throwe;}}}this._callbacks.splice(0,len);this._lastVal+=len;}};new(window.MutationObserver||JsMutationObserver)(Polymer.Async._atEndOfMicrotask.bind(Polymer.Async)).observe(Polymer.Async._twiddle,{characterData: true});Polymer.Debounce=function(){varAsync=Polymer.Async;varDebouncer=function(context){this.context=context;this.boundComplete=this.complete.bind(this);};Debouncer.prototype={go: function(callback,wait){varh;this.finish=function(){Async.cancel(h);};h=Async.run(this.boundComplete,wait);this.callback=callback;},stop: function(){if(this.finish){this.finish();this.finish=null;}},complete: function(){if(this.finish){this.stop();this.callback.call(this.context);}}};functiondebounce(debouncer,callback,wait){if(debouncer){debouncer.stop();}else{debouncer=newDebouncer(this);}debouncer.go(callback,wait);returndebouncer;}returndebounce;}();
🐱
The text was updated successfully, but these errors were encountered:
Hi @ryanwhite04, as you suggested this could be already achieved by setting a high value to duration.
Edge cases like 0, -10 or Infinity are not currently handled (toast won't show), I'll fix that.
It would be cool to be able to set an attribute for an infinite duration to use the paper-toast for things like showing a terms and cookie policy link on a site, shown here which can't go away until it is closed by the user.
You can already just put in a huge wait so it's necessary, It would just be cool.
Maybe something like
or even possible
I'm not sure what actually happens when you put a wait time of '0', except it calls debounce with a wait of '0' which calls async with a wait time of '0'
paper-toast.html
polymer.html
🐱
The text was updated successfully, but these errors were encountered: