1var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 2 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 3 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 4 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 5 return c > 3 && r && Object.defineProperty(target, key, r), r; 6}; 7var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 8 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 9 return new (P || (P = Promise))(function (resolve, reject) { 10 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 11 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 12 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 13 step((generator = generator.apply(thisArg, _arguments || [])).next()); 14 }); 15}; 16class NotificationsOptions { 17 constructor() { 18 this.variant = Variant.Neutral; 19 this.icon = null; 20 this.duration = 0; 21 this.allowHtml = false; 22 this.hideCloseButton = false; 23 } 24} 25class Notifications extends Static { 26 static init() { 27 return __awaiter(this, void 0, void 0, function* () { 28 Notifications.container = document.createElement('notification-container'); 29 document.body.appendChild(Notifications.container); 30 }); 31 } 32 static Show(message, options = null) { 33 let element = document.createElement('notification'); 34 element.setAttribute(options.variant, null); 35 let content = document.createElement('content'); 36 if (options.allowHtml) 37 content.innerHTML = message; 38 else 39 content.innerText = message; 40 element.appendChild(content); 41 let isClosed = false; 42 function closeElement() { 43 if (isClosed) 44 return; 45 element.classList.remove('shown'); 46 element.classList.add('closing'); 47 setTimeout(() => element.remove(), 150); 48 } 49 if (!options.hideCloseButton) { 50 let closeButton = document.createElement('close'); 51 closeButton.innerHTML = `<i class="nf nf-fae-thin_close"></i>`; 52 closeButton.onclick = closeElement; 53 element.appendChild(closeButton); 54 } 55 if (options.duration > 0) { 56 setTimeout(closeElement, options.duration); 57 } 58 element = Notifications.container.appendChild(element); 59 setTimeout(() => { 60 element.classList.add('shown'); 61 }, 1); 62 return element; 63 } 64} 65__decorate([ 66 onInitialize 67], Notifications, "init", null); 68//# sourceMappingURL=notifications.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.