Sha256: 0cff85c1efbefb63fee9c7b0dfcc7a3d089d32b39430896259dada81b99027c8
Contents?: true
Size: 854 Bytes
Versions: 22
Compression:
Stored size: 854 Bytes
Contents
import { CocoComponent } from "@assets/js/coco/component"; import Cookies from "js-cookie"; export default CocoComponent("systemBanner", (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
22 entries across 22 versions & 1 rubygems