-
Notifications
You must be signed in to change notification settings - Fork 229
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
Localstorage on the Pebble #18
Comments
That's right, pebble.js doesn't currently use persistent storage. The issue lies in how the pebble.js C shell would know what to do with the data. The C shell only knows enough to display what is shown currently. Since it forwards all events to the phone, it means it doesn't know what to display based on a given input even if it has the data locally. If we wanted to solve that problem, the solution is a DSL or a vastly simplified and limited API that hooks events to combinations of actions and data, but this would mean using JavaScript as a vessel for a DSL or API vastly simpler than both JavaScript and C. A limiting DSL or API is often frustrating to use if designed poorly. We can make the extreme case of using JavaScript as the DSL. I have thought about this idea, but there would still be issues with code dependency. For example, if your button handler called a function from a charting library, the resulting compiled code would be too great to send over bluetooth. If the idea is to only instantly show what was last shown on the watch, then that greatly simplifies the problem. That is in fact something I've entertained and is possible. There are still some issues such as how pebble.js should decide which screen to snapshot. Perhaps the simplest implementation is to call a function that would snapshot the current screen. It is possible to extend the snapshot idea by adding instrumentation over button handlers that call or hide windows to have a snapshot per window and naively display the last saved snapshot of the window. This might be the feature you're requesting. There are some issues with this however such as asynchronous callbacks that show/hide a window. pebble.js would need to somehow know the callback belonged to a certain window's button press, such as by a new API. This may still need a snapshotting function to prevent automatically snapshotting a window while it is displaying "Loading..." If the idea is to save information on the watch so that switching phones means the data travels with the watch, that is also possible. There is one issue however; providing access to this means removing future persistent storage space pebble.js may use to cache data such as snapshotting the screen as outlined above. It may be in your interest to save the information in an online server indexed by the Pebble account token obtained via |
PebbleJS can currently subscribe to acceleration service: Would it be impossible to call persistent data storage functionality in a similar fashion: The watch display doesn't have to be changed when the persist functions are called. It would be great if also e.g. data logging API and wakeup API could be exposed to PebbleJS. |
In addition it would awesome if there was some way to program logic on the watch in the event of the watch not being connected to the phone, such as reading data from persistent storage and writing it to the screen. |
It is possible, but it would reduce the amount of persistent storage pebble.js may use as a cache in the future since it is limited to 4K. I suppose however now is the best time to experiment. I could permit a smaller amount, such as 2K, for example.
Unfortunately PebbleKit JS, the framework pebble.js is built on top of, doesn't support data logging. I can, however, create versions of pebble.js that use PebbleKit iOS/Android, though it would require the user to create a complementary phone app. Regardless, this is planned far in the future after pebble.js has a good featureset. It'll probably also make it very confusing to explain what pebble.js and the PebbleKits are at that point.
I definitely plan to do that! There is a ticket #7, though I forgot to reply.
I agree, it would be awesome. The difficulty however is the first half of my first reply before this one. But it's a good reminder that I should experiment while pebble.js is still in beta. |
Is there any way to persist data on the Pebble itself using PebbleJs?
I know that I can use the Javascript Localstorage methods
window.localStorage.setItem
andwindow.localStorage.getItem
to read and write data, but this is persistent on the phone and requires an active connection to the phone in order to display that data on the Pebble.I also know that if I use C sdk I can use the
persist_write_data
and thepersist_read_data
methods to read and write data on the watch itself.If there is no way to store data locally on the Pebble itself, can this be a feature request?
The text was updated successfully, but these errors were encountered: