pr3y / Bruce

Predatory ESP32 Firmware
https://bruce.computer
GNU Affero General Public License v3.0
487 stars 80 forks source link

Flipper like JS format #305

Open MegaTheLEGEND opened 2 weeks ago

MegaTheLEGEND commented 2 weeks ago

Describe the solution you'd like

It would be Cool if the JS interpreter followed the same format as that of the Flipper.

Additional context

instead of this

wifiConnect(ssid : string);

dialogError(msg : string);

it would be like this

let math = require("math");  // math modual would be cool. (maybe it already exists?)
let badusb = require("badusb");
let wifi = require("wifi");
let dialog = require("dialog");

math.abs(-5); // 5
badusb.setup();

if (badusb.isConnected()) {
    badusb.press("E");
} else {
   dialog.error("failed to connect badusb"); //  Show an error
}

wifi.connect(ssid : string);

This provides a more organized method of calling functions and also would increase possible interoperability between Bruce and Flipper scripts

https://github.com/flipperdevices/flipperzero-firmware/tree/dev/documentation/js

eadmaster commented 2 weeks ago

i've investigated this a bit already, it needs this optional extra module.

MegaTheLEGEND commented 2 weeks ago

That would be cool. Also I feel like it would be great if users could share their js apps on a catalog on the website. A lot of times the most innovative and creative ideas come from the users and community.

pr3y commented 2 weeks ago

Loved this idea! this will probably be added soon! For now, there is a channel where people can share apps on our official Discord, here or in the projects thread