New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bemquery-async-dom

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bemquery-async-dom - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

41

CHANGELOG.md
# bemquery-async-dom Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
---
## 0.1.4
## [0.1.5] – 2016-09-17
### Added
* Ability to install package via [Bower](https://bower.io/).
## [0.1.4] – 2016-08-08
### Changed
* Updated boilerplate.
## 0.1.3
## [0.1.3] – 2016-07-10
### Changed
* Updated CI configuration.
* Updated dependencies.
## 0.1.2
## [0.1.2] – 2016-06-24
### Changed
* Updated rollup configuration.
* Updated dependencies.
### Fixed
* Fixed wrong project name in documentation.
## 0.1.1
## [0.1.1] – 2016-05-08
### Changed
* Updated dependencies.
## 0.1.0
## [0.1.0] – 2016-05-04
### Changed
* Changed to be working with [bemquery-selector-converter](https://github.com/BEMQuery/bemquery-selector-converter).
## 0.0.2
### Fixed
* Fixed not working tests.
## 0.0.1
## 0.0.1 – 2016-04-29
### Added
* Added `BEMQuery.prototype.html` and `BEMQuery.prototype.getStates` methods.
* Added `BEMQuery.prototype.html` and `BEMQuery.prototype.getStates` methods.
[0.1.5]: https://github.com/BEMQuery/bemquery-async-dom/compare/v0.1.4...v0.1.5
[0.1.4]: https://github.com/BEMQuery/bemquery-async-dom/compare/v0.1.3...v0.1.4
[0.1.3]: https://github.com/BEMQuery/bemquery-async-dom/compare/v0.1.2...v0.1.3
[0.1.2]: https://github.com/BEMQuery/bemquery-async-dom/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/BEMQuery/bemquery-async-dom/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/BEMQuery/bemquery-async-dom/compare/v0.0.1...v0.1.0

@@ -1,2 +0,2 @@

/*! bemquery-async-dom v0.1.4 | (c) 2016 BEMQuery team | MIT license (see LICENSE) */
/*! bemquery-async-dom v0.1.5 | (c) 2016 BEMQuery team | MIT license (see LICENSE) */
import { BEMQuery } from 'bemquery-core';

@@ -169,2 +169,4 @@

};
/** @class BEMQuery */
//# sourceMappingURL=bemquery-async-dom.js.map

@@ -1,2 +0,2 @@

/*! bemquery-async-dom v0.1.4 | (c) 2016 BEMQuery team | MIT license (see LICENSE) */
/*! bemquery-async-dom v0.1.5 | (c) 2016 BEMQuery team | MIT license (see LICENSE) */
(function (global, factory) {

@@ -6,171 +6,173 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('bemquery-core')) :

(factory(global.bemquery));
}(this, function (bemqueryCore) { 'use strict';
}(this, (function (bemqueryCore) { 'use strict';
/** Class storing queue of DOM operations. */
class Batch {
/**
* Constructing new batch.
*
* @class
*/
constructor() {
this.read = [];
this.write = [];
}
/**
* Add new operation to the batch.
*
* @param {String} type Type of operation. Must be either "read" or "write".
* @param {Function} fn Operation to be fired.
* @return {BEMQuery} Current BEMQuery instance.
*/
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 );
}
/**
* Run operations of given type.
*
* @param {String} type Type of operations to run. Must be either "read" or "write".
* @return {Promise} Promise that will be fulfilled after running all tasks.
*/
run( type = 'read' ) {
if ( type !== 'read' && type !== 'write' ) {
throw new TypeError( 'Type must be either \'read\' or \'write\'.' );
}
return new Promise( ( resolve ) => {
requestAnimationFrame( () => {
const results = [];
this[ type ].forEach( ( fn ) => {
results.push( fn() );
} );
this[ type ] = [];
return resolve( results );
} );
} );
}
}
/** Class storing queue of DOM operations. */
class Batch {
/**
* Method that runs all read operations stored in batch
* Constructing new batch.
*
* @return {Promise} Promise returned by batch.
* @memberof BEMQuery
* @class
*/
bemqueryCore.BEMQuery.prototype.read = function() {
if ( !this.batch ) {
this.batch = new Batch();
}
constructor() {
this.read = [];
this.write = [];
}
return this.batch.run( 'read' );
};
/**
* Method that runs all write operations stored in batch
* Add new operation to the batch.
*
* @return {Promise} Promise returned by batch.
* @memberof BEMQuery
* @param {String} type Type of operation. Must be either "read" or "write".
* @param {Function} fn Operation to be fired.
* @return {BEMQuery} Current BEMQuery instance.
*/
bemqueryCore.BEMQuery.prototype.write = function() {
if ( !this.batch ) {
this.batch = new Batch();
add( type, fn ) {
if ( type !== 'read' && type !== 'write' ) {
throw new TypeError( 'Type must be either \'read\' or \'write\'.' );
}
return this.batch.run( 'write' );
};
if ( typeof fn !== 'function' ) {
throw new TypeError( 'Task must be a function.' );
}
this[ type ].push( fn );
}
/**
* Method for getting/setting inner HTML of all elements in collection
* Run operations of given type.
*
* @param {String} [newHTML] The new inner HTML value. If not specified,
* the method will work as getter.
* @return {BEMQuery} Current BEMQuery instance.
* @memberof BEMQuery
* @param {String} type Type of operations to run. Must be either "read" or "write".
* @return {Promise} Promise that will be fulfilled after running all tasks.
*/
bemqueryCore.BEMQuery.prototype.html = function( newHTML ) {
if ( !this.batch ) {
this.batch = new Batch();
run( type = 'read' ) {
if ( type !== 'read' && type !== 'write' ) {
throw new TypeError( 'Type must be either \'read\' or \'write\'.' );
}
if ( typeof newHTML !== 'undefined' ) {
newHTML = String( newHTML );
return new Promise( ( resolve ) => {
requestAnimationFrame( () => {
const results = [];
this.batch.add( 'write', () => {
const elements = this.elements;
elements.forEach( ( element ) => {
element.innerHTML = newHTML;
this[ type ].forEach( ( fn ) => {
results.push( fn() );
} );
} );
} else {
this.batch.add( 'read', () => {
const elements = this.elements;
const htmls = [];
elements.forEach( ( element ) => {
htmls.push( element.innerHTML );
} );
this[ type ] = [];
return htmls;
return resolve( results );
} );
}
} );
}
}
return this;
};
/**
* Method that runs all read operations stored in batch
*
* @return {Promise} Promise returned by batch.
* @memberof BEMQuery
*/
bemqueryCore.BEMQuery.prototype.read = function() {
if ( !this.batch ) {
this.batch = new Batch();
}
function processClasses( converter, element ) {
const states = [];
return this.batch.run( 'read' );
};
[].forEach.call( element.classList, ( className ) => {
const state = converter.getStateFromClass( String( className ) );
/**
* Method that runs all write operations stored in batch
*
* @return {Promise} Promise returned by batch.
* @memberof BEMQuery
*/
bemqueryCore.BEMQuery.prototype.write = function() {
if ( !this.batch ) {
this.batch = new Batch();
}
if ( state ) {
states.push( state );
}
} );
return this.batch.run( 'write' );
};
return states;
/**
* Method for getting/setting inner HTML of all elements in collection
*
* @param {String} [newHTML] The new inner HTML value. If not specified,
* the method will work as getter.
* @return {BEMQuery} Current BEMQuery instance.
* @memberof BEMQuery
*/
bemqueryCore.BEMQuery.prototype.html = function( newHTML ) {
if ( !this.batch ) {
this.batch = new Batch();
}
/**
* Method for getting states from all elements in collection.
*
* @return {BEMQuery} Current BEMQuery instance.
* @memberof BEMQuery
*/
bemqueryCore.BEMQuery.prototype.getStates = function() {
if ( !this.batch ) {
this.batch = new Batch();
}
if ( typeof newHTML !== 'undefined' ) {
newHTML = String( newHTML );
const elements = this.elements;
this.batch.add( 'write', () => {
const elements = this.elements;
elements.forEach( ( element ) => {
element.innerHTML = newHTML;
} );
} );
} else {
this.batch.add( 'read', () => {
const result = [];
const elements = this.elements;
const htmls = [];
elements.forEach( ( element ) => {
result.push( processClasses( this.converter, element ) );
htmls.push( element.innerHTML );
} );
return result;
return htmls;
} );
}
return this;
};
return this;
};
}));
function processClasses( converter, element ) {
const states = [];
[].forEach.call( element.classList, ( className ) => {
const state = converter.getStateFromClass( String( className ) );
if ( state ) {
states.push( state );
}
} );
return states;
}
/**
* Method for getting states from all elements in collection.
*
* @return {BEMQuery} Current BEMQuery instance.
* @memberof BEMQuery
*/
bemqueryCore.BEMQuery.prototype.getStates = function() {
if ( !this.batch ) {
this.batch = new Batch();
}
const elements = this.elements;
this.batch.add( 'read', () => {
const result = [];
elements.forEach( ( element ) => {
result.push( processClasses( this.converter, element ) );
} );
return result;
} );
return this;
};
/** @class BEMQuery */
})));
//# sourceMappingURL=bemquery-async-dom.umd.js.map
{
"name": "bemquery-async-dom",
"version": "0.1.4",
"version": "0.1.5",
"description": "BEM asynchronous DOM module",

@@ -11,10 +11,27 @@ "main": "dist/bemquery-async-dom.umd.js",

"test": "karma start config/karma/default.js",
"precommit": "npm test",
"commitmsg": "commitplease .git/COMMIT_EDITMSG",
"prebuild": "npm test",
"build": "rollup -c config/rollup/umd.js && rollup -c config/rollup/es6.js && rollup -c config/rollup/es5.js",
"build-docs": "jsdoc -c config/jsdoc/default.json ./src",
"publish-docs": "npm run build-docs && git checkout gh-pages && ncp docs/dist ./ && git add -A && git commit -m \"[ci skip] Updated docs.\" && git push origin gh-pages && git checkout master",
"preversion": "npm test",
"postversion": "git push origin && git push origin --tags",
"publish-docs": "npm run build-docs && git checkout gh-pages && ncp docs/dist ./ && git add -A && git commit -m \"docs(gh-pages): update docs [ci skip]\" && git push origin gh-pages && git checkout master",
"preversion": "npm run build && git add -f dist/",
"postversion": "git rm -r --cached dist/ && git commit -m \"chore(dist): clean after release [ci skip]\" && git push origin && git push origin --tags",
"prepublish": "in-publish && npm run build || exit 0"
},
"commitplease": {
"nohook": true,
"style": "angular",
"types": [
"feat",
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"chore"
],
"scope": "\\S+.*"
},
"repository": {

@@ -47,9 +64,12 @@ "type": "git",

"chai": "^3.5.0",
"commitplease": "^2.7.2",
"cz-conventional-changelog": "^1.2.0",
"docdash": "^0.4.0",
"eslint": "^3.0.1",
"husky": "^0.11.7",
"in-publish": "^2.0.0",
"ink-docstrap": "^1.2.1",
"is-travis": "^1.0.0",
"jsdoc": "^3.4.0",
"karma": "^1.0.0",
"karma-chrome-launcher": "^1.0.1",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.0.0",

@@ -66,5 +86,5 @@ "karma-firefox-launcher": "^1.0.0",

"ncp": "^2.0.0",
"rollup": "^0.34.0",
"rollup": "^0.35.10",
"rollup-plugin-babel": "^2.6.1",
"rollup-plugin-commonjs": "^3.0.0",
"rollup-plugin-commonjs": "^5.0.0",
"rollup-plugin-mockr": "^1.0.1",

@@ -76,3 +96,8 @@ "rollup-plugin-node-resolve": "^2.0.0",

"uglify-js": "^2.6.2"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
# bemquery-async-dom
[![Build Status](https://travis-ci.org/BEMQuery/bemquery-async-dom.svg?branch=master)](https://travis-ci.org/BEMQuery/bemquery-async-dom) [![Dependency Status](https://david-dm.org/BEMQuery/bemquery-async-dom.svg)](https://david-dm.org/BEMQuery/bemquery-async-dom) [![devDependency Status](https://david-dm.org/BEMQuery/bemquery-async-dom/dev-status.svg)](https://david-dm.org/BEMQuery/bemquery-async-dom#info=devDependencies)
[![Build Status](https://travis-ci.org/BEMQuery/bemquery-async-dom.svg?branch=master)](https://travis-ci.org/BEMQuery/bemquery-async-dom) · [![Dependency Status](https://david-dm.org/BEMQuery/bemquery-async-dom.svg)](https://david-dm.org/BEMQuery/bemquery-async-dom) · [![devDependency Status](https://david-dm.org/BEMQuery/bemquery-async-dom/dev-status.svg)](https://david-dm.org/BEMQuery/bemquery-async-dom#info=devDependencies) · [![Known Vulnerabilities](https://snyk.io/test/github/bemquery/bemquery-async-dom/badge.svg)](https://snyk.io/test/github/bemquery/bemquery-async-dom) ·[![Package quality](http://packagequality.com/badge/bemquery-async-dom.png)](http://packagequality.com/#?package=bemquery-async-dom) · [![npm version](https://badge.fury.io/js/bemquery-async-dom.svg)](https://badge.fury.io/js/bemquery-async-dom) · [![Bower version](https://badge.fury.io/bo/bemquery-async-dom.svg)](https://badge.fury.io/bo/bemquery-async-dom)

@@ -15,4 +15,9 @@ Experiment with implementing asynchronous DOM.

You can also install it from bower:
```bash
bower install bemquery-async-dom
```
## Documentation
Docs are available at http://bemquery.github.io/bemquery-async-dom

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc