Files
even-g2/docs/pages/build_page-lifecycle.md

60 lines
3.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Page Lifecycle | Documentation
-
-
-
-
-
-
Skip to contentDocumentationSearch⌘CtrlK Main Navigation PortalThemeMenuReturn to top Sidebar Navigation
## Get Started
Overview
### Quickstart
Sign inHardwareInstall Node.js & npmInstall Even Hub toolingYour First AppTemplatesArchitecture
## Build
Page LifecycleDisplay & UI SystemUI/UX Design GuidelinesDevice APIsContextual MenuNetworkingBackground & Lifecycle
## Test
SimulatorLocal TestingPrivate TestingBeta Testing
## Ship
Packaging & DeploymentApp Submission & QA Guidelines
## Reference
GlossaryCLIVersioning PolicyChangelogFAQ
## AI Tooling
Claude CodeOn this pageLast updated: 2026-08-25Every glasses screen flows through a small set of SDK calls - one for creation, two for updating, one for shutting down.
## Methods ​
|
| | Method | Purpose | Notes
| | createStartUpPageContainer | Create the initial page | Called exactly once at startup. Returns result code. Takes an optional menuObject - see Contextual Menu.
| | rebuildPageContainer | Replace the entire page | Full redraw - all state is lost, brief flicker on hardware. Omitting menuObject clears the custom menu.
| | textContainerUpgrade | Update text in-place | Faster, flicker-free on hardware. Requires matching containerID + containerName. Optional textColor re-brightens the text (SDK 0.0.14+).
| | updateImageRawData | Update an image container | No concurrent sends allowed. LZ4-compressed in transit (SDK 0.0.12+) - no code change.
| | shutDownPageContainer | Exit the app | Pass 1 for the system exit-confirmation dialog (required on the root page); pass 0 for immediate exit (internal pages only).
| | callEvenApp | Generic method call | Escape hatch - all typed methods are wrappers around this.
## Result codes ​
For createStartUpPageContainer: |
| | Code | Meaning
| | 0 | Success
| | 1 | Invalid parameters
| | 2 | Oversize
| | 3 | Out of memoryrebuildPageContainer, textContainerUpgrade, and shutDownPageContainer return boolean.updateImageRawData returns a status string: success, imageException, imageSizeInvalid, imageToGray4Failed, or sendFailed.
## Best practices ​
- Always call shutDownPageContainer(1) from the root page. Mode 1 shows the system exit-confirmation dialog. QA reviewers explicitly check for it. Apps that exit silently with mode 0 from the root - or use a custom in-app exit UI in its place - get rejected. Mode 0 is only OK on internal pages where the user already confirmed.
- Use textContainerUpgrade for frequent text updates (counters, status, live data). It skips the flicker of a full rebuild.
- Use rebuildPageContainer only when the layout itself changes - adding or removing containers, switching between text and list.
- Match containerID and containerName exactly when calling textContainerUpgrade. Mismatches silently no-op.
- Don't call updateImageRawData concurrently. Wait for one to resolve before sending the next.
- Re-send menuObject on every rebuild that should keep the menu. rebuildPageContainer replaces the menu wholesale; leaving menuObject out clears your items rather than preserving them.PagerPrevious pageBuildNext pageDisplay & UI System