Socket
Book a DemoInstallSign in
Socket

chain-time

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chain-time

chain time logger

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
1
-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

chain-time

chain time logger

install

npm install chain-time

example

import {ChainTime,TiggerType} from 'chain-time'
const chainTimeStart2End = new ChainTime()
// start 2 end
chainTimeStart2End.start()
//doSomething
chainTimeStart2End.record('hello');
//doSomething
chainTimeStart2End.record('world');
//doSomething
chainTimeStart2End.end()
//doSomething
chainTimeStart2End.getTiggerData()
/**
 output:
 {
  "chain": [
    {
      "name": "start",
      "timestamp": 1625562923922
    },
    {
      "name": "hello",
      "timestamp": 1625562924924
    },
    {
      "name": "world",
      "timestamp": 1625562925929
    },
    {
      "name": "end",
      "timestamp": 1625562926933
    }
  ],
  "log": "start->1002ms->hello->1005ms->world->1004ms->end"
}
*/

const chainTimeStartByTimeOut = new ChainTime({
    tiggerFunction:()=>{
        console.log(`timeout${timeOut}:`+JSON.stringify(chainTime.getTiggerData(),null,2))
        /**
        output:
        {
            "chain": [
                {
                "name": "start",
                "timestamp": 1625562920911
                },
                {
                "name": "hello",
                "timestamp": 1625562921914
                }
            ],
            "log": "start->1003ms->hello"
            }
        */
    },
    tiggerType:TiggerType.Timeout,
    timeOut:1500
})
chainTimeStartByTimeOut.start()
await sleep(1000);
chainTimeStartByTimeOut.record('hello');
await sleep(1000);
chainTimeStartByTimeOut.record('world');
await sleep(1000);
chainTimeStartByTimeOut.end()

Keywords

chain

FAQs

Package last updated on 06 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.