JSPM

edge-library

3.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q40995F

Simplifying use of edge.js to wrap .NET libraries

Package Exports

  • edge-library
  • edge-library/lib/edge-library.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (edge-library) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

edge-library

Node module to simplify use of edge.js to wrap .NET libraries.

  1. Allows a group of .NET methods to be instantiated as a block
  2. Methods are lower-cased
  3. Methods are wrapped in $q promises
  4. Arguments are transformed to an array

Installation

npm install edge-library --save

Use

var EdgeLibrary = require('../lib/edge-library').EdgeLibrary;

var test_library_definition = {
    assemblyFile: require('path').join(__dirname, './cs/bin/Release/com.blackpear.edge.test.dll'),
    type: {
        name: 'com.blackpear.edge.test.Lib',
        method: [
            'GetString',
            {
                name: 'GetJsonString',
                return: 'json'
            },
            'Add'
        ]
    }
};

var lib = new EdgeLibrary(test_library_definition);

Method calls use $q promises in place of node.js callbacks:

lib.reflectstring('edge.js rocks!').then(
    function(value){
        console.log(value);
    },
    function(err){
        console.log('ERR:', err);
    }
);

Methods with more than one argument are transformed to an array:

lib.add(1, 2).then(
    function(value){
        console.log(value);
    },
    function(err){
        console.log('ERR:', err);
    }
);

Acknowledgements

Development supported by Black Pear Software Ltd