Skip to content

Commit

Permalink
Added more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Nov 11, 2022
1 parent 62da52d commit 962542e
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions libs/banglejs/jswrap_bangle.c
Expand Up @@ -5186,7 +5186,7 @@ application to launch.
"generate_js" : "libs/js/banglejs/Bangle_showClock.min.js",
"ifdef" : "BANGLEJS"
}
Load the Bangle.js clock.
Load the Bangle.js clock - this has the same effect as calling `Bangle.load()`.
*/

/*JSON{
Expand All @@ -5195,16 +5195,24 @@ Load the Bangle.js clock.
"name" : "load",
"generate_js" : "libs/js/banglejs/Bangle_load.min.js",
"params" : [
["file","JsVar","A string containing the file name for the app to be loaded"]
["file","JsVar","(optional) A string containing the file name for the app to be loaded"]
],
"ifdef" : "BANGLEJS",
"typescript": [
"load(file: string): void;",
"load(): void;"
]
}
Load an app while checking if fast loading is possible. Calling this without
a name loads the clock.
This behaves the same as the global `load()` function, but if fast
loading is possible (`Bangle.setUI` was called with a `remove` handler)
then instead of a complete reload, the `remove` handler will be
called and the new app will be loaded straight after.
`load()` is slower, but safer. As such, care should be taken
when using `Bangle.load()` with `Bangle.setUI({..., remove:...})`
as if your remove handler doesn't completely clean up after your app,
memory leaks or other issues could occur - see `Bangle.setUI` for more
information.
*/

/*JSON{
Expand Down Expand Up @@ -5618,10 +5626,11 @@ Bangle.setUI({
});
```
If `remove` is specified, `Bangle.showLauncher` (and some apps) may choose to just call this and then
load a new app without resetting Bangle.js. As a result, **if you specify 'remove' you should
make sure you test that after calling it your app is completely unloaded** otherwise you may
end up with a memory leak.
If `remove` is specified, `Bangle.showLauncher`, `Bangle.showClock`, `Bangle.load` and some apps
may choose to just call the `remove` function and then load a new app without resetting Bangle.js.
As a result, **if you specify 'remove' you should make sure you test that after calling `Bangle.setUI()`
without arguments your app is completely unloaded**, otherwise you may end up with memory leaks or
other issues when switching apps.
*/
/*JSON{
"type" : "staticmethod", "class" : "Bangle", "name" : "setUI", "patch":true,
Expand Down

0 comments on commit 962542e

Please sign in to comment.