modularload
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -308,2 +308,4 @@ 'use strict'; | ||
value: function setAttributes() { | ||
var _this5 = this; | ||
var title = this.data.getElementsByTagName('title')[0]; | ||
@@ -321,3 +323,3 @@ var description = this.data.head.querySelector('meta[name="description"]'); | ||
document.querySelector('html').setAttribute('data-' + key, val); | ||
document.querySelector('html').setAttribute('data-' + _this5.toDash(key), val); | ||
}); | ||
@@ -327,2 +329,7 @@ } | ||
}, { | ||
key: "toDash", | ||
value: function toDash(str) { | ||
return str.split(/(?=[A-Z])/).join('-').toLowerCase(); | ||
} | ||
}, { | ||
key: "hideContainer", | ||
@@ -344,7 +351,7 @@ value: function hideContainer() { | ||
value: function loadEls(container) { | ||
var _this5 = this; | ||
var _this6 = this; | ||
var promises = []; | ||
this.loadAttributes.forEach(function (attr) { | ||
var data = 'data-' + _this5.name + '-' + attr; | ||
var data = 'data-' + _this6.name + '-' + attr; | ||
var els = container.querySelectorAll('[' + data + ']'); | ||
@@ -369,3 +376,3 @@ | ||
Promise.all(promises).then(function (val) { | ||
var imagesEvent = new Event(_this5.namespace + 'images'); | ||
var imagesEvent = new Event(_this6.namespace + 'images'); | ||
window.dispatchEvent(imagesEvent); | ||
@@ -398,3 +405,3 @@ }); | ||
value: function on(event, func) { | ||
var _this6 = this; | ||
var _this7 = this; | ||
@@ -404,9 +411,9 @@ window.addEventListener(this.namespace + event, function () { | ||
case 'loading': | ||
return func(_this6.transition, _this6.oldContainer); | ||
return func(_this7.transition, _this7.oldContainer); | ||
case 'loaded': | ||
return func(_this6.transition, _this6.oldContainer, _this6.newContainer); | ||
return func(_this7.transition, _this7.oldContainer, _this7.newContainer); | ||
case 'ready': | ||
return func(_this6.transition, _this6.newContainer); | ||
return func(_this7.transition, _this7.newContainer); | ||
@@ -413,0 +420,0 @@ default: |
@@ -306,2 +306,4 @@ function _classCallCheck(instance, Constructor) { | ||
value: function setAttributes() { | ||
var _this5 = this; | ||
var title = this.data.getElementsByTagName('title')[0]; | ||
@@ -319,3 +321,3 @@ var description = this.data.head.querySelector('meta[name="description"]'); | ||
document.querySelector('html').setAttribute('data-' + key, val); | ||
document.querySelector('html').setAttribute('data-' + _this5.toDash(key), val); | ||
}); | ||
@@ -325,2 +327,7 @@ } | ||
}, { | ||
key: "toDash", | ||
value: function toDash(str) { | ||
return str.split(/(?=[A-Z])/).join('-').toLowerCase(); | ||
} | ||
}, { | ||
key: "hideContainer", | ||
@@ -342,7 +349,7 @@ value: function hideContainer() { | ||
value: function loadEls(container) { | ||
var _this5 = this; | ||
var _this6 = this; | ||
var promises = []; | ||
this.loadAttributes.forEach(function (attr) { | ||
var data = 'data-' + _this5.name + '-' + attr; | ||
var data = 'data-' + _this6.name + '-' + attr; | ||
var els = container.querySelectorAll('[' + data + ']'); | ||
@@ -367,3 +374,3 @@ | ||
Promise.all(promises).then(function (val) { | ||
var imagesEvent = new Event(_this5.namespace + 'images'); | ||
var imagesEvent = new Event(_this6.namespace + 'images'); | ||
window.dispatchEvent(imagesEvent); | ||
@@ -396,3 +403,3 @@ }); | ||
value: function on(event, func) { | ||
var _this6 = this; | ||
var _this7 = this; | ||
@@ -402,9 +409,9 @@ window.addEventListener(this.namespace + event, function () { | ||
case 'loading': | ||
return func(_this6.transition, _this6.oldContainer); | ||
return func(_this7.transition, _this7.oldContainer); | ||
case 'loaded': | ||
return func(_this6.transition, _this6.oldContainer, _this6.newContainer); | ||
return func(_this7.transition, _this7.oldContainer, _this7.newContainer); | ||
case 'ready': | ||
return func(_this6.transition, _this6.newContainer); | ||
return func(_this7.transition, _this7.newContainer); | ||
@@ -411,0 +418,0 @@ default: |
{ | ||
"name": "modularload", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Dead simple page transitions and lazy loading.", | ||
@@ -5,0 +5,0 @@ "repository": "modularorg/modularload", |
@@ -235,3 +235,3 @@ export default class { | ||
Object.entries(datas).forEach(([key, val]) => { | ||
document.querySelector('html').setAttribute('data-' + key, val); | ||
document.querySelector('html').setAttribute('data-' + this.toDash(key), val); | ||
}); | ||
@@ -241,2 +241,6 @@ } | ||
toDash(str) { | ||
return str.split(/(?=[A-Z])/).join('-').toLowerCase(); | ||
} | ||
hideContainer() { | ||
@@ -243,0 +247,0 @@ this.newContainer.style.visibility = 'hidden'; |
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
40635
1009