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

namirasoft-core

Package Overview
Dependencies
Maintainers
0
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

namirasoft-core - npm Package Compare versions

Comparing version 1.4.32 to 1.4.34

5

dist/SetTimeouService.d.ts
export declare class SetTimeouService {
private last;
private last_date;
private last_index;
private onCalled;
setTimeoutIfNotCalledAgain(callback: () => void, milliseconds: number): void;
setTimeoutIfFarArrival(callback: () => void, milliseconds: number): void;
}

23

dist/SetTimeouService.js

@@ -7,15 +7,28 @@ "use strict";

constructor() {
this.last = new Date();
this.last_date = new Date();
this.last_index = 0;
}
onCalled(milliseconds) {
this.last_index++;
let l = TimeOperation_1.TimeOperation.millisecondsLater(milliseconds - 1, this.last_date);
if (this.last_date < l)
this.last_date = l;
return this.last_index;
}
setTimeoutIfNotCalledAgain(callback, milliseconds) {
let l = TimeOperation_1.TimeOperation.millisecondsLater(milliseconds - 1, this.last);
if (this.last < l)
this.last = l;
let index = this.onCalled(milliseconds);
setTimeout(() => {
if (this.last < new Date())
if (index === this.last_index)
callback();
}, milliseconds);
}
setTimeoutIfFarArrival(callback, milliseconds) {
this.onCalled(milliseconds);
setTimeout(() => {
if (this.last_date < new Date())
callback();
}, milliseconds);
}
}
exports.SetTimeouService = SetTimeouService;
//# sourceMappingURL=SetTimeouService.js.map

@@ -11,3 +11,3 @@ {

"private": false,
"version": "1.4.32",
"version": "1.4.34",
"author": "Amir Abolhasani",

@@ -14,0 +14,0 @@ "license": "MIT",

@@ -5,14 +5,30 @@ import { TimeOperation } from "./TimeOperation";

{
private last: Date = new Date();
private last_date: Date = new Date();
private last_index: number = 0;
private onCalled(milliseconds: number)
{
this.last_index++;
let l = TimeOperation.millisecondsLater(milliseconds - 1, this.last_date);
if (this.last_date < l)
this.last_date = l;
return this.last_index;
}
setTimeoutIfNotCalledAgain(callback: () => void, milliseconds: number)
{
let l = TimeOperation.millisecondsLater(milliseconds - 1, this.last);
if (this.last < l)
this.last = l;
let index = this.onCalled(milliseconds);
setTimeout(() =>
{
if (this.last < new Date())
if (index === this.last_index)
callback();
}, milliseconds);
}
setTimeoutIfFarArrival(callback: () => void, milliseconds: number)
{
this.onCalled(milliseconds);
setTimeout(() =>
{
if (this.last_date < new Date())
callback();
}, milliseconds);
}
}

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