Comparing version 0.9.16 to 0.9.18
{ | ||
"name": "material", | ||
"version": "0.9.16", | ||
"version": "0.9.18", | ||
"description": "A lightweight implementation of Material Design Components for the web - ES6", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,3 +19,3 @@ class Element { | ||
for (const key in this.options) { | ||
if (!['tag', 'container', 'html', 'text', 'id'].includes(key)) { | ||
if (!['tag', 'container', 'html', 'text', 'id', 'data'].includes(key)) { | ||
element.setAttribute(key, this.options[key]) | ||
@@ -25,2 +25,7 @@ } | ||
// Apply additional dataset | ||
for (const key in this.options.data) { | ||
element.setAttribute('data-' + key, this.options.data[key]) | ||
} | ||
// Append to container if available | ||
@@ -27,0 +32,0 @@ if (this.options.container) { |
@@ -0,4 +1,7 @@ | ||
import emitter from './module/emitter' | ||
class Loader { | ||
static defaults = { | ||
class: 'loader' | ||
class: 'loader', | ||
timeout: 10000 | ||
} | ||
@@ -13,2 +16,3 @@ | ||
this.options = { ...Loader.defaults, ...options } | ||
Object.assign(this, emitter) | ||
} | ||
@@ -81,5 +85,15 @@ | ||
this.element.classList.add('show') | ||
clearTimeout(this.timeout) | ||
if (this.options.timeout) { | ||
this.timeout = setTimeout(() => { | ||
this.hide() | ||
this.emit('timeout') | ||
}, this.options.timeout) | ||
} | ||
} | ||
hide () { | ||
clearTimeout(this.timeout) | ||
this.element.classList.remove('show') | ||
@@ -86,0 +100,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
499902
11931