Sha256: 954eb5c2563c6c7c97ad62b3f2339e0afd73298a61236f3c7d0a767ec463c887
Contents?: true
Size: 840 Bytes
Versions: 16
Compression:
Stored size: 840 Bytes
Contents
import { CocoComponent } from "@js/coco"; import Cookies from "js-cookie"; export default CocoComponent("appSystemBanner", (opts = {}) => { return { cookieName: null, cookieValue: null, cookieExpiry: null, init() { this.cookieName = opts.cookieName; this.cookieValue = opts.cookieValue; this.cookieExpiry = opts.cookieExpiry; }, onDismiss() { this.$dispatch("banner:dismiss", { banner: this }); if (this.shouldSetCookie) { Cookies.set(this.cookieName, this.cookieValue, { expires: this.cookieExpiry, }); } }, remove() { this.$root.remove(); }, get shouldSetCookie() { return Number.isInteger(this.cookieExpiry); }, root: { "@alert:dismiss": "onDismiss", "@alert:removed": "remove", }, }; });
Version data entries
16 entries across 16 versions & 1 rubygems