How to use the Context function from bindings

Find comprehensive JavaScript bindings.Context code examples handpicked from public code repositorys.

4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict';


const addon = require('bindings')('node_librealsense');


describe('Test Device interfaces', function() {
  let context = new addon.Context;
  let device = null;


  before(function(done) {
    context.getDevice(0).then((availableDevice) => {
fork icon21
star icon23
watch icon0

33
34
35
36
37
38
39
40
41
42
43
44


// Wrap context creation.
module.exports.createContext = function(options) {
    if (arguments.length > 1) {
        // NOTE: duplicated in getdns.js and GNContext.cpp.
        // TODO: use new getdns.Context(...args) when not supporting node.js v4 anymore.
        const tooManyArgumentsTypeError = new TypeError("Too many arguments.");
        tooManyArgumentsTypeError.code = getdns.constants.RETURN_INVALID_PARAMETER;


        throw tooManyArgumentsTypeError;
fork icon8
star icon63
watch icon0

19
20
21
22
23
24
25
26
27
28

const Pulse = require('bindings')('pulse.node');
const Events = require('events');
const Stream = require('stream');

const PulseContext = Pulse.Context;
const PulseStream = Pulse.Stream;

function str2bit(val, set, def) {
    let bit = set[def];
fork icon3
star icon14
watch icon4

50
51
52
53
54
55
  createDevice(options: DeviceOptions, cb: DataCallback): Device;
}

export var Context: {
  new(): Context
} = playcap.Context;
fork icon0
star icon2
watch icon3

Other functions in bindings

Sorted by popularity

function icon

bindings.createKey is the most popular function in bindings (8616 examples)