Comparing version 1.0.5 to 1.0.6
@@ -42,3 +42,3 @@ !(function() { | ||
this.fastdom.clear(task); | ||
tasks.delete(task); | ||
tasks.delete(promise); | ||
} | ||
@@ -45,0 +45,0 @@ }; |
@@ -239,5 +239,5 @@ !(function(win) { | ||
// Expose to CJS & AMD | ||
if ((typeof define)[0] == 'f') define(function() { return exports; }); | ||
else if ((typeof module)[0] == 'o') module.exports = exports; | ||
if ((typeof define) == 'function') define(function() { return exports; }); | ||
else if ((typeof module) == 'object') module.exports = exports; | ||
})( typeof window !== 'undefined' ? window : this); |
{ | ||
"name": "fastdom", | ||
"description": "Eliminates layout thrashing by batching DOM read/write operations", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"main": "fastdom.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -1,19 +0,20 @@ | ||
# fastdom [![Build Status](https://travis-ci.org/wilsonpage/fastdom.svg?branch=master)](https://travis-ci.org/wilsonpage/fastdom) [![Coverage Status](https://coveralls.io/repos/wilsonpage/fastdom/badge.svg?branch=master&service=github)](https://coveralls.io/github/wilsonpage/fastdom?branch=master) | ||
# fastdom [![Build Status](https://travis-ci.org/wilsonpage/fastdom.svg?branch=master)](https://travis-ci.org/wilsonpage/fastdom) [![NPM version](https://badge.fury.io/js/fastdom.svg)](http://badge.fury.io/js/fastdom) [![npm](https://img.shields.io/npm/dm/fastdom.svg?maxAge=2592000)]() [![Coverage Status](https://coveralls.io/repos/wilsonpage/fastdom/badge.svg?branch=master&service=github)](https://coveralls.io/github/wilsonpage/fastdom?branch=master) ![gzip size](http://img.badgesize.io/https://unpkg.com/fastdom/fastdom.min.js?compression=gzip) | ||
Eliminates layout thrashing by batching DOM read/write operations (~600 bytes minified gzipped). | ||
```js | ||
fastdom.measure(function() { | ||
fastdom.measure(() => { | ||
console.log('measure'); | ||
}); | ||
fastdom.mutate(function() { | ||
fastdom.mutate(() => { | ||
console.log('mutate'); | ||
}); | ||
fastdom.measure(function() { | ||
fastdom.measure(() => { | ||
console.log('measure'); | ||
}); | ||
fastdom.mutate(function() { | ||
fastdom.mutate(() => { | ||
console.log('mutate'); | ||
@@ -42,7 +43,4 @@ }); | ||
```sh | ||
$ npm install fastdom | ||
$ npm install fastdom --save | ||
``` | ||
```sh | ||
$ bower install fastdom | ||
``` | ||
@@ -68,4 +66,4 @@ or [download](http://github.com/wilsonpage/fastdom/raw/master/fastdom.js). | ||
```js | ||
fastdom.measure(function() { | ||
var width = element.clientWidth; | ||
fastdom.measure(() => { | ||
const width = element.clientWidth; | ||
}); | ||
@@ -79,3 +77,3 @@ ``` | ||
```js | ||
fastdom.mutate(function() { | ||
fastdom.mutate(() => { | ||
element.style.width = width + 'px'; | ||
@@ -90,4 +88,4 @@ }); | ||
```js | ||
var read = fastdom.measure(function(){}); | ||
var write = fastdom.mutate(function(){}); | ||
const read = fastdom.measure(() => {}); | ||
const write = fastdom.mutate(() => {}); | ||
@@ -130,3 +128,3 @@ fastdom.clear(read); | ||
```js | ||
fastdom.catch = function(error) { | ||
fastdom.catch = (error) => { | ||
// Do something if you want | ||
@@ -157,3 +155,3 @@ }; | ||
// extend fastdom | ||
var myFastdom = fastdom.extend(fastdomPromised); | ||
const myFastdom = fastdom.extend(fastdomPromised); | ||
@@ -167,3 +165,3 @@ // use new api | ||
```js | ||
var myFastdom = fastdom | ||
const myFastdom = fastdom | ||
.extend(fastdomPromised) | ||
@@ -176,4 +174,4 @@ .extend(fastdomSandbox); | ||
```js | ||
var myFastdom = fastdom.extend({ | ||
measure: function(fn, ctx) { | ||
const myFastdom = fastdom.extend({ | ||
measure(fn, ctx) { | ||
// do custom stuff ... | ||
@@ -180,0 +178,0 @@ |
@@ -21,4 +21,5 @@ 'use strict'; | ||
window.fastdom = module.exports = fastdom.extend({ | ||
measure: function(task, ctx) { | ||
measure: function(fn, ctx) { | ||
debug('measure'); | ||
var task = !ctx ? fn : fn.bind(ctx); | ||
return this.fastdom.measure(function() { | ||
@@ -30,4 +31,5 @@ if (!enabled) return task(); | ||
mutate: function(task, ctx) { | ||
mutate: function(fn, ctx) { | ||
debug('mutate'); | ||
var task = !ctx ? fn : fn.bind(ctx); | ||
return this.fastdom.mutate(function() { | ||
@@ -34,0 +36,0 @@ if (!enabled) return task(); |
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
45343
1286
220