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

call-func

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

call-func - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

27

build/cjs/src/index.js

@@ -57,6 +57,13 @@ "use strict";

var timer;
return function () {
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 250;
return function (option) {
var _ref = option || {},
_ref$delay = _ref.delay,
delay = _ref$delay === void 0 ? 250 : _ref$delay,
args = _ref.args,
scope = _ref.scope;
clearTimeout(timer);
timer = setTimeout(func, defaultDelay || delay);
timer = setTimeout(function () {
return (0, _callfunc["default"])(func, args, scope);
}, defaultDelay || delay);
};

@@ -77,8 +84,12 @@ };

var run = function run() {
var run = function run(option) {
var _ref2 = option || {},
args = _ref2.args,
scope = _ref2.scope;
lastCall = false;
(0, _callfunc["default"])(func);
(0, _callfunc["default"])(func, args, scope);
};
return function () {
return function (option) {
lastCall = true;

@@ -88,3 +99,3 @@

waiting = true;
run();
run(option);
setTimeout(function () {

@@ -94,3 +105,3 @@ waiting = false;

if (needRunLast && lastCall) {
run();
run(option);
}

@@ -97,0 +108,0 @@ }, threshhold);

@@ -24,6 +24,13 @@ import callfunc from "./callfunc";

var timer;
return function () {
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 250;
return function (option) {
var _ref = option || {},
_ref$delay = _ref.delay,
delay = _ref$delay === void 0 ? 250 : _ref$delay,
args = _ref.args,
scope = _ref.scope;
clearTimeout(timer);
timer = setTimeout(func, defaultDelay || delay);
timer = setTimeout(function () {
return callfunc(func, args, scope);
}, defaultDelay || delay);
};

@@ -42,8 +49,12 @@ };

var run = function run() {
var run = function run(option) {
var _ref2 = option || {},
args = _ref2.args,
scope = _ref2.scope;
lastCall = false;
callfunc(func);
callfunc(func, args, scope);
};
return function () {
return function (option) {
lastCall = true;

@@ -53,3 +64,3 @@

waiting = true;
run();
run(option);
setTimeout(function () {

@@ -59,3 +70,3 @@ waiting = false;

if (needRunLast && lastCall) {
run();
run(option);
}

@@ -62,0 +73,0 @@ }, threshhold);

{
"name": "call-func",
"version": "0.1.2",
"version": "0.1.3",
"description": "call function",

@@ -5,0 +5,0 @@ "repository": "react-atomic/react-atomic-organism",

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