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

most

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

most - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

2

bower.json
{
"name": "most",
"main": "most.js",
"version": "0.6.0",
"version": "0.6.1",
"homepage": "https://github.com/cujojs/most",

@@ -6,0 +6,0 @@ "authors": [

@@ -13,2 +13,4 @@ /** @license MIT License (c) copyright 2010-2014 original author or authors */

var delayed = promise.delay;
var never = promise.never;
var raceIndex = promise.raceIndex;
var Yield = step.Yield;

@@ -23,2 +25,4 @@ var Pair = step.Pair;

exports.delayOn = delayOn;
exports.debounce = debounce;
exports.debounceOn = debounceOn;
exports.throttle = throttle;

@@ -109,2 +113,60 @@ exports.throttleOn = throttleOn;

}, when(stepper, s.state));
}
/**
* Wait for a burst of events to subside and emit only the last event in the burst
* stream: abcd----abcd----
* debounce(2, stream): -----d-------d--
* @param {Number} period events occuring more frequently than this
* will be suppressed
* @param {Stream} stream stream to debounce
* @returns {Stream} new debounced stream
*/
function debounce(period, stream) {
return debounceOn(Scheduler.getDefault(), period, stream);
}
/**
* Wait for a burst of events to subside and emit only the last event in the burst
* stream: abcd----abcd----
* debounce(2, stream): -----d-------d--
* @param {Scheduler} scheduler
* @param {Number} period events occuring more frequently than this
* on the provided scheduler will be suppressed
* @param {Stream} stream stream to debounce
* @returns {Stream} new debounced stream
*/
function debounceOn(scheduler, period, stream) {
var stepper = stream.step;
return new Stream(function(s) {
return stepDebounce(scheduler, period, stepper, s);
}, { timer: void 0, prev: void 0, next: void 0, state: stream.state });
}
function stepDebounce(scheduler, period, step, s) {
return stepEarliest(scheduler, period, step, s.timer === void 0 ? initState(step, s) : s);
}
function stepEarliest(scheduler, period, step, s) {
return raceIndex(function(winner, index) {
return index === 0 ? yieldDebounced(s)
: winner.done ? winner
: stepEarliest(scheduler, period, step, nextState(scheduler, period, step, winner));
}, [s.timer, s.next]);
}
function initState(step, s) {
return { timer: never(), prev: s.prev, next: when(step, s.state), state: s.state };
}
function nextState (scheduler, period, step, winner) {
return { timer: delayed(period, 'timer', scheduler), prev: winner,
next: when(step, winner.state), state: winner.state };
}
function yieldDebounced(s) {
return when(function (prev) {
return new Yield(prev.value, { timer: never(), prev: void 0,
next: s.next, state: prev.state });
}, s.prev);
}

@@ -335,2 +335,4 @@ /** @license MIT License (c) copyright 2010-2014 original author or authors */

var throttleOn = timed.throttleOn;
var debounce = timed.debounce;
var debounceOn = timed.debounceOn;

@@ -343,2 +345,4 @@ exports.periodic = timed.periodic;

exports.throttleOn = throttleOn;
exports.debounce = debounce;
exports.debounceOn = debounceOn;

@@ -365,1 +369,15 @@ /**

};
/**
* Wait for a burst of events to subside and emit only the last event in the burst
* stream: abcd----abcd----
* debounce(2, stream): -----d-------d--
* @param {Number} period events occuring more frequently than this
* on the provided scheduler will be suppressed
* @param {Scheduler=} scheduler optional scheduler
* @returns {Stream} new debounced stream
*/
Stream.prototype.debounce = function(period, scheduler) {
return arguments.length > 1 ? debounceOn(scheduler, period, this)
: debounce(period, this);
};
{
"name": "most",
"version": "0.6.0",
"version": "0.6.1",
"description": "Monadic streams",

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

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