webxdc / webxdc-dev

A development server for webxdc apps
The Unlicense
18 stars 4 forks source link

previous updates should appear on other device too #4

Closed Simon-Laux closed 2 years ago

Simon-Laux commented 2 years ago

expected: app has all previous state updates, even if the update was sent before the instance was opened/started actual: app only has updates from the time it was active, and on reload it looses all state.

faassen commented 2 years ago

I'd like to understand this a bit better in relationship to the use of localstorage and such.

Are updates always replayed entirely each time an application is opened, even if it's been opened before? What use is localstorage in this case?

r10s commented 2 years ago

Are updates always replayed entirely each time an application is opened, even if it's been opened before?

webxdc's can control which updates they receive by passing a "last known serial" to setUpdateListener().

by default, the last known serial is "0", which means that webxdc get all updates ever received.

however, an webxdc can also accumulate its state, save it in localStorage together with "last known serial" and only request new updates next time (by reading "last known serial" from localStorage and pass that to setUpdateListener())

faassen commented 2 years ago

It is more clear to me n, thanks! I have done a rework in version 0.3.1 that should have much better behavior concerning all this. Hopefully this time I got it right!