New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

x-time

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

x-time

setTimeout() with native promises

latest
Source
npmnpm
Version
1.1.10
Version published
Weekly downloads
23
283.33%
Maintainers
1
Weekly downloads
 
Created
Source

x-time

setTimeout() with native promises

Build Status Test Coverage

bitHound Code bitHound Overall Score bitHound Dependencies bitHound Dev Dependencies License: MIT

Installation

npm install x-time --save

Example

const xTime = require('x-time')

xTime(1000, 'one').then(value => {
  console.log(`waited ${value} second`)
})

You can also await the x-time promise:

await xTime(1000)

Import in Typescript

The default import syntax of TypeScript does not work with this module because it exports a function directly. You need to use the following syntax in order to get completions:

import xTime = require('x-time')

Function: xTime(time[, value])

  • time <Number> duration of timeout in ms
  • value <any> value to resolve the promise with

Returns a promise that gets resolved to the value when the time has passed.

Keywords

promise

FAQs

Package last updated on 16 Dec 2017

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