bemquery-async-dom
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,4 +5,8 @@ # bemquery-async-dom Changelog | ||
## 0.0.1 | ||
## 0.1.1 | ||
* Updated dependencies. | ||
## 0.1.0 | ||
* Changed to be working with [bemquery-selector-converter](https://github.com/BEMQuery/bemquery-selector-converter). | ||
@@ -9,0 +13,0 @@ |
@@ -1,3 +0,2 @@ | ||
/*! BEMQuery v0.0.1 | (c) 2016 BEMQuery | MIT license (see LICENSE) */ | ||
(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(require("bemquery-core")):typeof define==="function"&&define.amd?define(["bemquery-core"],factory):factory(global.bemquery)})(this,function(bemqueryCore){"use strict";var babelHelpers={};babelHelpers.classCallCheck=function(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}};babelHelpers.createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor}}();babelHelpers;var Batch=function(){function Batch(){babelHelpers.classCallCheck(this,Batch);this.read=[];this.write=[]}babelHelpers.createClass(Batch,[{key:"add",value:function add(type,fn){if(type!=="read"&&type!=="write"){throw new TypeError("Type must be either 'read' or 'write'.")}if(typeof fn!=="function"){throw new TypeError("Task must be a function.")}this[type].push(fn)}},{key:"run",value:function run(){var _this=this;var type=arguments.length<=0||arguments[0]===undefined?"read":arguments[0];if(type!=="read"&&type!=="write"){throw new TypeError("Type must be either 'read' or 'write'.")}return new Promise(function(resolve){requestAnimationFrame(function(){var results=[];_this[type].forEach(function(fn){results.push(fn())});_this[type]=[];return resolve(results)})})}}]);return Batch}();bemqueryCore.BEMQuery.prototype.read=function(){if(!this.batch){this.batch=new Batch}return this.batch.run("read")};bemqueryCore.BEMQuery.prototype.write=function(){if(!this.batch){this.batch=new Batch}return this.batch.run("write")};bemqueryCore.BEMQuery.prototype.html=function(newHTML){var _this=this;if(!this.batch){this.batch=new Batch}if(typeof newHTML!=="undefined"){newHTML=String(newHTML);this.batch.add("write",function(){var elements=_this.elements;elements.forEach(function(element){element.innerHTML=newHTML})})}else{this.batch.add("read",function(){var elements=_this.elements;var htmls=[];elements.forEach(function(element){htmls.push(element.innerHTML)});return htmls})}return this};function processClasses(converter,element){var states=[];[].forEach.call(element.classList,function(className){var state=converter.getStateFromClass(String(className));if(state){states.push(state)}});return states}bemqueryCore.BEMQuery.prototype.getStates=function(){var _this=this;if(!this.batch){this.batch=new Batch}var elements=this.elements;this.batch.add("read",function(){var result=[];elements.forEach(function(element){result.push(processClasses(_this.converter,element))});return result});return this}}); | ||
//# sourceMappingURL=./dist/bemquery-async-dom.es5.js.map | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("bemquery-core")):"function"==typeof define&&define.amd?define(["bemquery-core"],e):e(t.bemquery)}(this,function(t){"use strict";function e(t,e){var r=[];return[].forEach.call(e.classList,function(e){var n=t.getStateFromClass(String(e));n&&r.push(n)}),r}var r={};r.classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r.createClass=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var n=function(){function t(){r.classCallCheck(this,t),this.read=[],this.write=[]}return r.createClass(t,[{key:"add",value:function(t,e){if("read"!==t&&"write"!==t)throw new TypeError("Type must be either 'read' or 'write'.");if("function"!=typeof e)throw new TypeError("Task must be a function.");this[t].push(e)}},{key:"run",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?"read":arguments[0];if("read"!==e&&"write"!==e)throw new TypeError("Type must be either 'read' or 'write'.");return new Promise(function(r){requestAnimationFrame(function(){var n=[];return t[e].forEach(function(t){n.push(t())}),t[e]=[],r(n)})})}}]),t}();t.BEMQuery.prototype.read=function(){return this.batch||(this.batch=new n),this.batch.run("read")},t.BEMQuery.prototype.write=function(){return this.batch||(this.batch=new n),this.batch.run("write")},t.BEMQuery.prototype.html=function(t){var e=this;return this.batch||(this.batch=new n),"undefined"!=typeof t?(t=String(t),this.batch.add("write",function(){var r=e.elements;r.forEach(function(e){e.innerHTML=t})})):this.batch.add("read",function(){var t=e.elements,r=[];return t.forEach(function(t){r.push(t.innerHTML)}),r}),this},t.BEMQuery.prototype.getStates=function(){var t=this;this.batch||(this.batch=new n);var r=this.elements;return this.batch.add("read",function(){var n=[];return r.forEach(function(r){n.push(e(t.converter,r))}),n}),this}}); | ||
//# sourceMappingURL=bemquery-async-dom.es5.js.map |
@@ -1,2 +0,2 @@ | ||
/*! bemquery-async-dom v0.1.0 | (c) 2016 BEMQuery team | MIT license (see LICENSE) */ | ||
/*! bemquery-async-dom v0.1.1 | (c) 2016 BEMQuery team | MIT license (see LICENSE) */ | ||
import { BEMQuery } from 'bemquery-core'; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
/*! bemquery-async-dom v0.1.0 | (c) 2016 BEMQuery team | MIT license (see LICENSE) */ | ||
/*! bemquery-async-dom v0.1.1 | (c) 2016 BEMQuery team | MIT license (see LICENSE) */ | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('bemquery-core')) : |
{ | ||
"name": "bemquery-async-dom", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "BEM asynchronous DOM module", | ||
@@ -53,4 +53,4 @@ "main": "dist/bemquery-async-dom.umd.js", | ||
"karma-chrome-launcher": "^1.0.1", | ||
"karma-coverage": "^0.5.5", | ||
"karma-firefox-launcher": "^0.1.7", | ||
"karma-coverage": "^1.0.0", | ||
"karma-firefox-launcher": "^1.0.0", | ||
"karma-fixture": "^0.2.6", | ||
@@ -57,0 +57,0 @@ "karma-html2js-preprocessor": "^1.0.0", |
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
35755
319