Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

function-tree

Package Overview
Dependencies
Maintainers
3
Versions
487
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

function-tree - npm Package Compare versions

Comparing version 0.5.0-0-alpha.5a3d129e to 0.5.0-0-alpha.5b8ecb8f

.nyc_output/601653c2535345c2972faf38b6053391.json

26

lib/factories/debounce.js

@@ -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.5a3d129e",
"version": "0.5.0-0-alpha.5b8ecb8f",
"description": "When a function is not enough",

@@ -15,3 +15,4 @@ "main": "lib/index.js",

"chalk": "^1.1.3",
"eventemitter3": "^2.0.2"
"eventemitter3": "^2.0.2",
"ws": "^1.1.1"
},

@@ -18,0 +19,0 @@ "directories": {

@@ -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?

@@ -94,2 +92,45 @@ 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.

#### Devtools
Download the function tree standalone debugger for [Mac](https://drive.google.com/file/d/0B1pYKovu9Upyb1Bkdm5IbkdBN3c/view?usp=sharing), [Windows](https://drive.google.com/file/d/0B1pYKovu9UpyMGRRbG45dWR6R1k/view?usp=sharing) or [Linux](https://drive.google.com/file/d/0B1pYKovu9UpyMFQ5dEdnSy1aN0E/view?usp=sharing).
```js
import Devtools from 'function-tree/devtools'
// Instantiate the devtools with the port
// you are running the debugger on
const devtools = Devtools({
remoteDebugger: 'localhost:8585'
})
// Add the provider to any instantiated
// function tree you want to pass
// information from
const execute = FunctionTree([
devtools.Provider({
colors: {
someContextProvider: 'green'
}
})
])
// Watch execution of the tree
devtools.watchExecution(execute)
export default execute;
```
You can now do:
```js
function someFunction(context) {
context.debugger.send({
method: 'someMethod',
args: ['foo', 'bar'],
color: 'red'
})
}
```
This is used by **ContextProvider** under the hood, but you are free to use this at your own leisure :)
#### Extending the context

@@ -96,0 +137,0 @@

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