@pelagiccreatures/sargasso
Advanced tools
Comparing version 0.7.1 to 0.7.2
@@ -26,4 +26,2 @@ /** | ||
const elementMetaData = new WeakMap() | ||
/* | ||
@@ -115,14 +113,7 @@ All subclasses of Sargasso must register the class so that | ||
setMetaData (k, v) { | ||
const data = elementMetaData.get(this.element) || {} | ||
if (v) { | ||
data[k] = v | ||
} else { | ||
delete data[k] | ||
} | ||
elementMetaData.set(this.element, data) | ||
elementTools.setMetaData(this.element, k, v) | ||
} | ||
getMetaData (k) { | ||
const data = elementMetaData.get(this.element) || {} | ||
return data[k] | ||
return elementTools.getMetaData(this.element, k) | ||
} | ||
@@ -129,0 +120,0 @@ |
@@ -14,2 +14,4 @@ /** | ||
const elementMetaData = new WeakMap() | ||
const _hasClass = (element, cssClass) => { | ||
@@ -75,2 +77,17 @@ const className = element.className || '' | ||
const _setMetaData = (element, k, v) => { | ||
const data = elementMetaData.get(element) || {} | ||
if (v) { | ||
data[k] = v | ||
} else { | ||
delete data[k] | ||
} | ||
elementMetaData.set(element, data) | ||
} | ||
const _getMetaData = (element, k) => { | ||
const data = elementMetaData.get(element) || {} | ||
return data[k] | ||
} | ||
const elementTools = { | ||
@@ -82,3 +99,5 @@ hasClass: _hasClass, | ||
inViewPort: _inViewPort, | ||
setCSS: _css | ||
setCSS: _css, | ||
setMetaData: _setMetaData, | ||
getMetaData: _getMetaData | ||
} | ||
@@ -85,0 +104,0 @@ |
{ | ||
"name": "@pelagiccreatures/sargasso", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "Simple, Fast, Reactive, supervised Javascript controllers for html elements.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
614773
9428