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

reactive-function

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactive-function - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

28

index.js
var ReactiveProperty = require("reactive-property");
var Graph = require("graph-data-structure");
// Use requestAnimationFrame if it is available.
// Otherwise fall back to setTimeout.
var nextFrame = setTimeout;
if(typeof requestAnimationFrame !== 'undefined') {
nextFrame = requestAnimationFrame;
}
// The singleton data dependency graph.

@@ -58,3 +65,3 @@ // Nodes are reactive properties.

// Assign node ids to inputs and the reactive function.
// Assign node ids to inputs and output.
assignId(output);

@@ -120,11 +127,16 @@ inputs.forEach(assignId);

// Returns a function that, when invoked, schedules the given function
// to execute once on the next tick of the JavaScript event loop.
// to execute once on the next frame.
// Similar to http://underscorejs.org/#debounce
function debounce(fn){
var timeout;
function debounce(callback){
var queued = false;
return function () {
clearTimeout(timeout);
timeout = setTimeout(fn)
if(!queued){
queued = true;
nextFrame(function () {
queued = false;
callback();
}, 0);
}
};
};
}

@@ -143,2 +155,4 @@ // Returns true if all elements of the given array are defined.

ReactiveFunction.nextFrame = nextFrame;
module.exports = ReactiveFunction;
{
"name": "reactive-function",
"version": "0.8.0",
"version": "0.8.1",
"description": "A library for managing data flows and changing state.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -192,3 +192,3 @@ // Unit tests for reactive-function.

setTimeout(function (){
ReactiveFunction.nextFrame(function (){
assert.equal(c(), 15);

@@ -213,3 +213,3 @@ done();

// Wait until after the first auto-digest.
setTimeout(function (){
ReactiveFunction.nextFrame(function (){

@@ -222,3 +222,3 @@ rf.destroy();

// Give time for an auto-digest to occur.
setTimeout(function (){
ReactiveFunction.nextFrame(function (){

@@ -225,0 +225,0 @@ // Confirm that a digest did not occur.

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