Skip to content

Javascript#139

Open
nicholastmosher wants to merge 4 commits intomasterfrom
javascript
Open

Javascript#139
nicholastmosher wants to merge 4 commits intomasterfrom
javascript

Conversation

@nicholastmosher
Copy link
Member

Not ready to merge

Dependent branches (must be merged first):


This is a tracking PR for bringing the Javascript bindings up to date with the current Flipper runtime. The JS bindings are designed to be run on node.js, not in the browser (however, there is an interesting possibility for using WebUSB in the future to allow web apps to control Flipper).

Currently these bindings are not yet fully functional, some of the bugs are still being worked out (things are still segfaulting and I haven't figured out why yet), but they are more organized towards how I expect them to look when they're done. Specifically, flipper.js contains all of the "engine" code for dispatching remote calls to Flipper, while all of the binding implementations have their own files. Led, as the "hello world" of packages, is implemented in led.js. The layout for all package bindings should look roughly like Led does, with a definition of the module API followed by wrappers for each function in the module.

test.js is a good reference to see how the user-facing API looks, I'll paste it here also:

const { Flipper, Led }  = require('./index');

const flipper = new Flipper();
const led = new Led(flipper);

led.rgb(0, 0, 10);

Note that we're making use of language features such as const and destructuring, meaning that there is some minimum version of node.js that will be required to use these bindings (I don't remember exactly when those were introduced, but I think it was quite awhile ago).

To Do

For this PR:

  • Figure out why things segfault right now
  • Implement more bindings

For JS eventually:

  • Implement JS binding generation with the console
  • Publish on npm

@georgemorgan
Copy link
Collaborator

Maybe we could do a quick update on this for the most recent changes to Dyld?

@georgemorgan
Copy link
Collaborator

Do we want to get this in sync with dyld and then merge it into dyld?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants