Complete "Entering / exiting fullscreen" pattern documentation
Add `App_onhostcontextchanged_respondToDisplayMode` example showing how to listen for display mode changes and update UI with `classList.toggle()`. Update `App_requestDisplayMode_fullscreen` to `App_requestDisplayMode_toggle` to show the common toggle pattern checking `availableDisplayModes` first. Refactor full examples (pdf-server, shadertoy-server) to use `classList.toggle(class, condition)` instead of add/remove branches. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
566ac58ab7
commit
dce143e92e
2 changed files with 43 additions and 47 deletions
|
|
@ -43,9 +43,15 @@ Use the SDK's style helpers to apply host styling, then reference them in your C
|
|||
|
||||
{@includeCode ./patterns.tsx#hostStylingReact}
|
||||
|
||||
## [TODO] Support fullscreen / exit fullscreen
|
||||
## Entering / Exiting fullscreen
|
||||
|
||||
{@includeCode ./patterns.tsx#fullscreen}
|
||||
Toggle fullscreen mode by calling {@link app!App.requestDisplayMode requestDisplayMode}:
|
||||
|
||||
{@includeCode ../src/app.examples.ts#App_requestDisplayMode_toggle}
|
||||
|
||||
Listen for display mode changes via {@link app!App.onhostcontextchanged onhostcontextchanged} to update your UI:
|
||||
|
||||
{@includeCode ../src/app.examples.ts#App_onhostcontextchanged_respondToDisplayMode}
|
||||
|
||||
## [TODO] Persist data (incl. widget state)
|
||||
|
||||
|
|
|
|||
|
|
@ -97,15 +97,6 @@ function hostStylingReact() {
|
|||
//#endregion hostStylingReact
|
||||
}
|
||||
|
||||
/**
|
||||
* Example: Support fullscreen / exit fullscreen
|
||||
*/
|
||||
function fullscreen() {
|
||||
//#region fullscreen
|
||||
// TODO: Implement fullscreen support
|
||||
//#endregion fullscreen
|
||||
}
|
||||
|
||||
/**
|
||||
* Example: Persist data (incl. widget state)
|
||||
*/
|
||||
|
|
@ -155,7 +146,6 @@ void authenticatedCalls;
|
|||
void errorsToModel;
|
||||
void hostStylingVanillaJs;
|
||||
void hostStylingReact;
|
||||
void fullscreen;
|
||||
void persistData;
|
||||
void lowerPerceivedLatency;
|
||||
void iframeAndMcpApps;
|
||||
|
|
|
|||
Loading…
Reference in a new issue