function-tree
Advanced tools
Comparing version 0.5.0-0-alpha.e0efed82 to 0.5.0-0-alpha.e514028a
@@ -6,5 +6,3 @@ 'use strict'; | ||
}); | ||
function createDebounce(time) { | ||
var execution = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { timer: null, resolve: null }; | ||
function createDebounce(time, execution) { | ||
function debounce(_ref) { | ||
@@ -15,3 +13,3 @@ var path = _ref.path; | ||
if (execution.timer) { | ||
execution.resolve(path.discarded()); | ||
execution.resolve(path.discard()); | ||
clearTimeout(execution.timer); | ||
@@ -21,3 +19,3 @@ } | ||
execution.timer = setTimeout(function () { | ||
execution.resolve(path.accepted()); | ||
execution.resolve(path.continue()); | ||
execution.timer = null; | ||
@@ -34,17 +32,15 @@ execution.resolve = null; | ||
function debounceFactory(time, continueBranch) { | ||
return [createDebounce(time), { | ||
accepted: continueBranch, | ||
discarded: [] | ||
}]; | ||
function debounceFactory(time) { | ||
// New execution on every call | ||
var execution = { timer: null, resolve: null }; | ||
return createDebounce(time, execution); | ||
} | ||
debounceFactory.shared = function () { | ||
// Shared execution | ||
var execution = { timer: null, resolve: null }; | ||
return function debounceSharedFactory(time, continueBranch) { | ||
return [createDebounce(time, execution), { | ||
accepted: continueBranch, | ||
discarded: [] | ||
}]; | ||
return function debounceSharedFactory(time) { | ||
return createDebounce(time, execution); | ||
}; | ||
@@ -51,0 +47,0 @@ }; |
{ | ||
"name": "function-tree", | ||
"version": "0.5.0-0-alpha.e0efed82", | ||
"version": "0.5.0-0-alpha.e514028a", | ||
"description": "When a function is not enough", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -6,6 +6,4 @@ # function-tree | ||
### Install | ||
This is still alpha but to test the bleeding edge | ||
This project is still in alpha. To test alpha version check [instructions in monorepo](https://github.com/cerebral/cerebral/blob/master/README.md). | ||
`npm install function-tree@next --save` | ||
### What is it? | ||
@@ -12,0 +10,0 @@ The article [The case for function-tree](http://www.christianalfoni.com/articles/2016_09_11_The-case-for-function-tree) will give you an explanation of why it was built and how it works. Please get your wet feet with that and/or have a look at the demos and API below. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
253732
43
1419
488
1