Comments (4)
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 Pebble.getAccountToken()
.
from pebblejs.
PebbleJS can currently subscribe to acceleration service:
Accel.init() => simply_accel_set_data_create()
Would it be impossible to call persistent data storage functionality in a similar fashion:
Watch.persist(key, value) => persist_write_data(key, value)
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.
from 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.
from pebblejs.
Would it be impossible to call persistent data storage functionality in a similar fashion:
Watch.persist(key, value) => persist_write_data(key, value)
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.
It would be great if also e.g. data logging API ...
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.
... wakeup API could be exposed to PebbleJS.
I definitely plan to do that! There is a ticket #7, though I forgot to reply.
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.
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.
from pebblejs.
Related Issues (20)
- [Bug] Run time error when show UI.card() HOT 4
- [Bug] Error when building with the SDK 3.10 HOT 1
- [Feature Request] Disconnected message as a customisable image, like the startup screen
- [Bug] Card goes fullscreen when going back from Menu
- need a cloudpebble update HOT 3
- Bug in OGPebble 3.11.1 HOT 3
- Accel 'tap' event not very sensitive HOT 4
- Number conversion to string - Menus HOT 2
- App crashed when move from a Window to Menu HOT 17
- [Bug] Menu Screen Dotted Line HOT 3
- [Bug] Scrolling issue on Aplite HOT 6
- Circle.radius accessor is undefined HOT 1
- Modifications while Voice window is the top window cause a crash HOT 1
- Cloud Pebble Unable to Upload Images (PNG)
- Settings.config callback crashes when passed option containing encoded percent sign HOT 2
- Pebble.js compilation fails for Pebble 2 / Diorid HOT 2
- Application crash on pebble HOT 10
- Porting Pebble.js to Canvas (rocky.js)
- Wakeup not discarding itself or cancelling
- .
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pebblejs.