Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript #139

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Javascript #139

wants to merge 4 commits into from

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