|
Hi! Is there a way to have some js run during the installation process when loading apps to the Bangle? For the twenties app we now have a boot file that sets up the app and then deletes itself: https://github.com/espruino/BangleApps/blob/7537413ba30c761de46befd54e46b96da7c54aa7/apps/twenties/boot.js This works OK, but it has the side effect of having to regenerate the I also now want to do something similar with the Could that setting up be done during the installation process instead to avoid the boot file "hack"? I tried to understand if the Thanks! |
Replies: 1 comment 5 replies
|
Yes, but
For install-time code, the App Loader already has the { name: "RAM", content: js }For the Twenties case, the shape I would try is to upload the library first and then add a RAM entry that performs the setup: "storage": [
{ "name": "twenties", "url": "lib.js" },
{ "name": "RAM", "content": "require('twenties').setup();" }
]That makes the setup run during upload instead of keeping a temporary If the setup needs App Loader UI choices or connected-device information, use a |
Yes, but
evaluate: trueis not the part I would use for this.evaluateonly changes how uploaded file content is handled: the data is not quoted as a string before upload, so it is useful for entries like generated image/content expressions. It is not really a post-install hook.For install-time code, the App Loader already has the
RAMpath. Inmetadata.jsonstorage entries,name: "RAM"means the code is sent directly to the Bangle and is not saved as a file. Existing apps use the same pattern from custom pages, for example sending:For the Twenties case, the shape I would try is to upload the library first and then add a RAM entry that performs the setup:
"st…