LearnNewsExamplesConnect
Frontmatter
assigneestobiu
createdAtFeb 2, 2026, 3:01 PM
updatedAtFeb 2, 2026, 10:19 PM
githubUrlhttps://github.com/neomjs/neo/issues/8951
authortobiu
commentsCount1
parentIssue8948
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtFeb 2, 2026, 10:19 PM

Feat: Smart Initialization for SparklineComponent

tobiu
tobiu commented on Feb 2, 2026, 3:01 PM

Update DevRank.view.SparklineComponent to demonstrate the "Smart Component" pattern.

Logic:

  1. Check: On initialization, query if the Canvas Worker is available.
  2. Start: If not, call Neo.worker.Manager.startWorker('canvas').
  3. Load: Call Canvas.loadModule('apps/devrank/canvas/Sparkline.mjs').
  4. Register: Proceed with register() only after these steps succeed.

Note: This removes the need for canvas.mjs entry point edits for this component.

tobiu
tobiu Feb 2, 2026, 10:18 PM

Input from Gemini 3 Pro:

✦ Implemented smart initialization logic in SparklineComponent:

  1. initAsync Implementation:
    • Checks for Canvas Worker availability and starts it on-demand via Neo.worker.Manager.startWorker.
    • Waits for the worker to boot and register its remote methods (specifically loadModule).
    • Dynamically loads the Sparkline.mjs renderer module using Neo.worker.Canvas.loadModule.
  2. Robust Registration:
    • Updated afterSetOffscreenRegistered to await me.ready(). This ensures that the component does not attempt to register the canvas with the renderer until the initAsync sequence (and thus module loading) is fully complete.

This removes the need for manual canvas.mjs configuration for this component and prevents race conditions during startup.