Socket
Socket
Sign inDemoInstall

nv-facutil-clock

Package Overview
Dependencies
7
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

57

index.js

@@ -288,2 +288,8 @@

const {
set_interval_without_rslts,
_psj,
} = require("nv-facutil-promise");
class Cron {

@@ -318,7 +324,7 @@ #interval = null

clear() {
clearInterval(this.#interval);
this.#interval();
this.#interval = null
}
launch() {
this.#interval = setInterval(
let {newClearInterval} = set_interval_without_rslts(
()=> {

@@ -331,6 +337,53 @@ let d = this.#auto.dict();

);
this.#interval = newClearInterval;
}
}
const now = ()=>(new Date()).getTime()
class StopWatch {
#start_at = undefined;
#end_at = undefined;
#psj = undefined;
get start_at_() {return(this.#start_at)}
get end_at_() {return(this.#end_at)}
get passed_() {
if(this.#end_at !== undefined) {
return(this.#end_at - this.#start_at)
} else if(this.#start_at !== undefined) {
return(now() - this.#start_at)
} else {
}
}
clear() {
this.#start_at = undefined
this.#end_at = undefined
this.#psj = undefined
}
start() {
this.clear();
this.#psj = _psj();
this.#start_at = now();
return(this.#psj[0])
}
stop() {
this.#end_at = now();
let d = {start_at:this.#start_at,end_at:this.#end_at,costed:this.passed_}
this.#psj[1](d);
return(d)
}
get [Symbol.toStringTag]() {
let d = `start_at:${this.#start_at} duration:${this.passed_} end_at:${this.#end_at}`
return(d)
}
}
module.exports = {
now,
////
StopWatch,
stop_watch:new StopWatch(),
////
ERROR_DICT,

@@ -337,0 +390,0 @@ Auto,

7

package.json
{
"name": "nv-facutil-clock",
"version": "1.0.3",
"version": "1.0.4",
"description": "clock,date,generator,stream,cron",

@@ -17,3 +17,6 @@ "main": "index.js",

"author": "",
"license": "ISC"
"license": "ISC",
"dependencies": {
"nv-facutil-promise": "^1.0.27"
}
}

@@ -180,3 +180,3 @@ nv-facutil-clock

const {Cron} = require("./index")
const {Cron} = require("nv-facutil-clock")
var frequency =1000

@@ -213,2 +213,44 @@ function task_func(a,b,c) {

stop watcher
-------------
> var stop_watch = new StopWatch()
undefined
> stop_watch
StopWatch [start_at:undefined duration:undefined end_at:undefined] {}
>
> var p = stop_watch.start()
undefined
> p
Promise {
<pending>,
[Symbol(async_id_symbol)]: 68,
[Symbol(trigger_async_id_symbol)]: 5,
[Symbol(destroyed)]: { destroyed: false }
}
> stop_watch
StopWatch [start_at:1639454327229 duration:7695 end_at:undefined] {}
> stop_watch
StopWatch [start_at:1639454327229 duration:9265 end_at:undefined] {}
> stop_watch
StopWatch [start_at:1639454327229 duration:10850 end_at:undefined] {}
>
> stop_watch
StopWatch [start_at:1639454327229 duration:13856 end_at:undefined] {}
> stop_watch.stop()
{ start_at: 1639454327229, end_at: 1639454350716, costed: 23487 }
>
> p
Promise {
{ start_at: 1639454327229, end_at: 1639454350716, costed: 23487 },
[Symbol(async_id_symbol)]: 68,
[Symbol(trigger_async_id_symbol)]: 5,
[Symbol(destroyed)]: { destroyed: false }
}
> stop_watch
StopWatch [start_at:1639454327229 duration:23487 end_at:1639454350716] {}
>
METHODS

@@ -215,0 +257,0 @@ =======

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc