cbuteau / exposeit

A javascript interface builder.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exposeit

Abstract

I wanted to build a library for building interfaces but jint and interface was taken. SO it became callconv....then exposeit...

Badges/Status

Circle CI Build

CircleCI

npm Version

npm version

npm big badge

NPM

Goal

Create a redirector that only exposes the functions you want to expose.

The idea is you use the mechanism to create an interface pointer to other modules developed by another group.

var exposeit = require('exposeit');

var complex = {
  _dict: {},
  stringProp: 'Look at this string',
  boolProp: false,
  numProp: 3.14,
  numPropInt: 20,
  store: function(key, value) {
    this._dict[key] = value;
  },
  get: function(key) {
    return this._dict[key];
  },
  dump: function() {
    var keys = Object.keys(this._dict);
    for (var i = 0; i < keys.length; i++) {
      var key = keys[i];
      console.log('key:' + key + ' value:' + this._dict[key]);
    }
  }
};

var compDef =  {
  store: function(key, value) {},
  get: function(key) {},
  dump: function() {}
};

var proxy = exposeit(complex, compDef);
// now proxy has store, get, dump

Plan

  • First Step Node JS module with tests.
  • Maybe rewrite using amddefine...
  • Second Step Web Lib also with Separate tests (separate jasmine config)
  • Third Step

https://github.com/jrburke/amdefine

https://itnext.io/testing-your-javascript-in-a-browser-with-jest-puppeteer-express-and-webpack-c998a37ef887

About

A javascript interface builder.

License:MIT License


Languages

Language:JavaScript 100.0%