1.0.3 • Published 5 years ago

@glencfl/ref-napi-binding v1.0.3

Weekly downloads
7
License
MIT
Repository
github
Last release
5 years ago

@glencfl/ref-napi-binding

This repository contains only the native module component of the ref-napi package. Separating this native module out from the JavaScript code was necessary for the use of ref-napi when writing an extension for Visual Studio Code.

This can be used in conjunction with @glencfl/ref-napi-di to conditionally load prebuilt, platform-specific variants of this native component at runtime. This is useful in environments where builds are not runnable.

Installation

This package is available through NPM as @glencfl/ref-napi-binding. This package is primarily intended to be used alongside the @glencfl/ref-napi-di package.

Installation of both using yarn:

yarn add @glencfl/ref-napi-binding @glencfl/ref-napi-di

Usage

The above installation method will also build this package as normal on your system. This is the most basic usage case, where build tools are expected to be available in both the production and development environment. A usage example for this case:

const binding = require('@glencfl/ref-napi-binding');
const ref = require('@glencfl/ref-napi-di')(binding);

The point of this package is to cater to more elaborate usage scenarios where builds are just outright out of the question in the production environment, while still maintaining that build compatibility for ease of development. This is the reason for pre-compiled binaries being available on the repository's releases page, though only for common desktop systems and architectures. It is still largely up to you as the user to come up with a scheme for delivering the appropriate binary onto the user's system and conditionally calling require() on the appropriate .node file.