Socket
Book a DemoInstallSign in
Socket

tick-id

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tick-id

Give each tick on the Node.js event loop it's own ID

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
88
-16.98%
Maintainers
1
Weekly downloads
 
Created
Source

tick-id

Give each tick on the Node.js event loop it's own ID.

A tick ID is nothing native to Node.js but an invention of this module. It can be useful if you for instance want to keep track of which events happen on the same tick.

Build status js-standard-style

Installation

npm install tick-id

Usage

The tick-id module exposes a function which will return the id of the current tick:

var assert = require('assert')
var tickId = require('tick-id')

// execute the tickId function to get the ID of the current tick
var id = tickId()

// calling tickId multiple times on the same tick will always return the
// same tick ID
assert.equal(id, tickId())

process.nextTick(function () {
  // call tickId on a separate tick and you'll get a different ID
  assert.notEqual(id, tickId())
})

License

MIT

Keywords

tick

FAQs

Package last updated on 29 Sep 2015

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