webxdc/pixel
16
4
Fork
You've already forked pixel
1

Do not beep on reload #10

Open
opened 2024年10月21日 19:56:44 +02:00 by link2xt · 2 comments

Currently the application beeps every time you open it when there are stored updates.

The simplest way to fix would be just to skip one beep, but then we will not beep on the very first pixel.

Probably something to consider for WebXDC spec, having a way to know when we have loaded all the updates we have locally e.g. to show a splash screen before this would be useful. Otherwise if loading all stored updates takes a long time (merge operation can be expensive for some CRDTs) user may start editing the wrong state.

Currently the application beeps every time you open it when there are stored updates. The simplest way to fix would be just to skip one beep, but then we will not beep on the very first pixel. Probably something to consider for WebXDC spec, having a way to know when we have loaded all the updates we have locally e.g. to show a splash screen before this would be useful. Otherwise if loading all stored updates takes a long time (merge operation can be expensive for some CRDTs) user may start editing the wrong state.
Owner
Copy link

If you call setUpdateListener(func, 0) to replay all updates then the first incoming update will have a update.max_serial attribute. Can't this be used for determining "initial load completed" and only start beeping when the serial goes above this max?

If you call `setUpdateListener(func, 0)` to replay all updates then the first incoming update will have a `update.max_serial` attribute. Can't this be used for determining "initial load completed" and only start beeping when the serial goes above this max?

there are some webxdc apps that are aware of "loading state" processing status updates when the app is just opened and there are accumulated unprocessed updates VS functionality when new updates are received while the app is already opened and waiting for events:

the app just need to process all updates silently when the event listener is set:

let inizialized = false;
function receiveUpdate(update) {
 drawPixel(update); // likely you will want a better approach that updates the model without refreshing UI and only do the actual drawing at the end when update.serial == max_serial for faster loading
 if (inizialized) beep();
}
window.webxdc.setUpdateListener(receiveUpdate, 0).then(() => inizialized = true);

besides that, it makes sense to cache board state and max_serial in window.localStorage instead of passing zero every time to setUpdateListener to avoid slow load times over time when a lot of updates are accumulated

there are some webxdc apps that are aware of "loading state" processing status updates when the app is just opened and there are accumulated unprocessed updates VS functionality when new updates are received while the app is already opened and waiting for events: the app just need to process all updates silently when the event listener is set: ``` let inizialized = false; function receiveUpdate(update) { drawPixel(update); // likely you will want a better approach that updates the model without refreshing UI and only do the actual drawing at the end when update.serial == max_serial for faster loading if (inizialized) beep(); } window.webxdc.setUpdateListener(receiveUpdate, 0).then(() => inizialized = true); ``` besides that, it makes sense to cache board state and max_serial in `window.localStorage` instead of passing zero every time to `setUpdateListener` to avoid slow load times over time when a lot of updates are accumulated
Sign in to join this conversation.
No Branch/Tag specified
main
link2xt/audio-envelope
link2xt/realtime
link2xt/buffering
link2xt/hold-to-draw
hpk/streamlining
v2
v1
v0.2
v0.1
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
webxdc/pixel#10
Reference in a new issue
webxdc/pixel
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?