Created
October 25, 2023 13:30
-
-
Save lucaszmoraes/9bcbf794bdcad1d207ff7e7ccb7192d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@hotwired/stimulus"),require("stimulus-use")):typeof define=="function"&&define.amd?define(["@hotwired/stimulus","stimulus-use"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.StimulusNotification=i(e.Stimulus,e.useTransition))})(this,function(e,i){"use strict";class t extends e.Controller{initialize(){this.hide=this.hide.bind(this)}connect(){i.useTransition(this),this.hiddenValue===!1&&this.show()}show(){this.enter(),this.timeout=setTimeout(this.hide,this.delayValue)}async hide(){this.timeout&&clearTimeout(this.timeout),await this.leave(),this.element.remove()}}return t.values={delay:{type:Number,default:3e3},hidden:{type:Boolean,default:!1}},t}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment