Socket
Socket
Sign inDemoInstall

setimmediate-napi

Package Overview
Dependencies
2
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

setimmediate-napi


Version published
Maintainers
1
Created

Readme

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

Last updated on 24 Jan 2020

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc