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

setimmediate-napi

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

setimmediate-napi

`setImmediate()` for N-API code

  • 1.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
40K
decreased by-12.99%
Maintainers
1
Weekly downloads
 
Created
Source

setimmediate-napi

setImmediate() for N-API code

Greenkeeper badge

NPM Version NPM Downloads Build Status Coverage Status Dependency Status

Installation

Install with npm:

$ npm install setimmediate-napi

Usage

In your binding.gyp:

    'include_dirs': ["<!@(node -p \"require('node-addon-api').include\")",
                     "<!@(node -p \"require('setimmediate-napi').include\")"],

(Just have "<!@(node -p \"require('setimmediate-napi').include\")" somewhere in that list, ok?)

In your C++ code:

#include <setimmediate.h>

int a = 10;
SetImmediate(env, [a]() {
  /* do something with a ... */
});

Keep in mind:

  • You need to use References to keep track of JS objects, since this code runs asynchronously.
  • Use MakeCallback rather than Call to make sure Node.js can track your async context.
  • This function can be invoked even when executing JS code itself is not allowed.

Keywords

FAQs

Package last updated on 20 Sep 2019

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

  • 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