diff options
author | Indrajith K L | 2017-12-19 14:21:29 +0530 |
---|---|---|
committer | Indrajith K L | 2017-12-19 14:21:29 +0530 |
commit | c0eb82f55a40f64025800c0ad2b6a05290576337 (patch) | |
tree | cce2a386dea2508de10d6a6bb58f492329173434 /src/vanilla.yo.notification.ts | |
parent | ab0d224a293dfb2e6f2f70fd1f8180f6957c15be (diff) | |
download | vanilla-yo-notification-c0eb82f55a40f64025800c0ad2b6a05290576337.tar.gz vanilla-yo-notification-c0eb82f55a40f64025800c0ad2b6a05290576337.tar.bz2 vanilla-yo-notification-c0eb82f55a40f64025800c0ad2b6a05290576337.zip |
Now supports
* type arguments,
* positional parameters and
* html as content
* Documentation updates
Diffstat (limited to 'src/vanilla.yo.notification.ts')
-rw-r--r-- | src/vanilla.yo.notification.ts | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/src/vanilla.yo.notification.ts b/src/vanilla.yo.notification.ts deleted file mode 100644 index 7b50804..0000000 --- a/src/vanilla.yo.notification.ts +++ /dev/null @@ -1,76 +0,0 @@ -// Import stylesheets -import './styles/style.css'; -import { Config } from './config.interface'; - -export default class VanillaYoNotification { - - private notificationTemplate: string; - private defaultConfig: Config; - private notifInner: any; - - constructor() { - this.defaultConfig = { - content: '', - footer: '', - timeout: 3000, - title: '' - } - this.init(); - } - - private init() { - - this.buildContainers(); - - - } - - buildContainers(){ - let container = document.createElement('div'); - container.className = "notif-mainContainer topRight"; - - this.notifInner = document.createElement('div'); - this.notifInner.className = "notif-inner"; - - container.appendChild(this.notifInner); - document.body.appendChild(container); - } - - - show(config: Config) { - - let notifContainer = document.createElement('div'); - notifContainer.className = "vanilla-yo-notification"; - - - this.notificationTemplate = ` - <div class="notification_container"> - <div class="notification_header"> - ${config.title ? config.title : this.defaultConfig.title} - </div> - <div class="notification_body"> - ${config.content ? config.content : this.defaultConfig.content} - </div> - <div class="notification_footer"> - ${config.footer ? config.footer : this.defaultConfig.footer} - </div> - </div> - `; - - notifContainer.innerHTML = (this.notificationTemplate); - - this.notifInner.appendChild(notifContainer); - - - setTimeout(() => { - this.destroyNotification(notifContainer); - }, (config.timeout ? config.timeout : this.defaultConfig.timeout)); - - - } - - private destroyNotification(container: Node) { - this.notifInner.removeChild(container); - } -} - |