Index of every page on this site: llms.txt
All skills
oahc09 avatar

/cocosair-application

@ed38648
by oahc09oahc09/cocosairjs3 stars
2
Run it yourself

Configure createAirApp options, canvas, lifecycle, screen sizing and context health. Use for WEBGL2_REQUIRED startup errors, scene replacement, session cleanup or lost contexts.

  • 10 files
  • 88.2 KB
  • MIT
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/oahc09/cocosairjs/cocosair-application

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescontext.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Working context

Use package imports and shipped docs for an application; use source paths and repository commands only in a confirmed AIR checkout. A copied host skill is not a runtime installation.

Read the shared environment rules when locating these roots. If sibling resources are unavailable, use the installed canonical chapter and disclose the limitation. Tool declarations identify workflow capabilities; they do not authorize installation, writes, publication or any action outside the user and host scope.

Related skills

Scene replacement by a page-stack component, physics backend internals and live-session inspection are owned by the cocosair-scene-graph, cocosair-physics and cocosair-agent-session skills (the router's Foundations row for this skill routes here for the app handle itself).

Original entry guidance

The original entry wording below is an on-demand archive, not a second routing source.

Historical import-order warnings below and in the original mistake reference conflict with the current admission contract. Main import may precede canvas creation; createAirApp validates and binds the selected canvas and DPR before engine initialization. Follow current startup options and main entry rules. Persistent SceneStack page ownership is input-action; the older sibling sentence above is retained provenance.

Use the environment rules to locate the checkout or installed package; sibling skills are optional direct dependencies, not a recursive load list.

Build the app handle correctly: admit options before the engine evaluates, run and release scenes through the single per-document runtime, and read context health and session ownership from the handle instead of guessing at engine internals.

Read references/quick-start.md when constructing the minimal example. It preserves the complete setup and teardown sequence; select the source-checkout or npm-consumer environment first.

Read references/context.md to select the owner of this step and only its directly needed dependencies. Reuse already loaded skills; this is not a recursive load list.

Original mistake navigation

Before implementing the relevant path, read its wrong/right examples in references/common-mistakes.md:

  • [HIGH] Importing the engine before the canvas is in the document
  • [HIGH] Creating a second app in the same document after close()
  • [HIGH] Using renderMode 3 to check rendered pixels
  • [MEDIUM] Treating attachContextHealth as automatic device restoration
  • [MEDIUM] Resuming in-document to recover from a context loss

Original metadata

Description and description_en

The two original fields contained exactly the same value, retained once here.

Configure and drive the Cocos AIR application handle - every AirAppOptions field vs its validator (canvas selector or element, renderMode 0..3, physics builtin or cannon, diagnostics errors or warnings, pixelRatioCap default 2, screenMode window or container, container, designResolution policy 0..4, contextLoss), the one-runtime-per-document admission rule keyed by Symbol.for('cocosair.bootstrap.v1'), the run/getScene/releaseScene/close lifecycle and the whole-page reload a closed runtime needs, startup error literals WEBGL2_REQUIRED and AIR_E_* codes, the attachContextHealth healthy/lost/restoring/failed state machine with no GPU rebuild, and createSessionScope ownership with (0,5000] timeoutMs. Use when starting a cocosair.js app with createAirApp, choosing or rejecting AirAppOptions values, hitting an AIR_E_ or WEBGL2_REQUIRED startup failure, replacing or releasing a scene, wiring screenMode container or designResolution, or reacting to a lost WebGL context.

Keywords

Cocos AIR, cocosair.js, application

References

  • app-options.md - AirAppOptions table with defaults and enforced ranges, policy and renderMode enum values, startup order and DPR timing, admission and identity rules, container DOM rules, lifecycle method and receipt field tables, declaration inventory and evidence status.
  • startup-errors.md - every AIR_E_* literal plus WEBGL2_REQUIRED and the un-coded import-order errors, with throw site, trigger and remedy.
  • context-health.md - state machine, snapshot and option fields, timeline cap, reload gate, what is not restored.
  • session-scope.md - generation and token rules, own() semantics, dispose timeout maths and receipt statuses.

Canonical docs

docs/manual/safe-startup-and-release.md, docs/webgl2-only.md, docs/manual/design-viewport-and-controls.md, docs/manual/scene-switching.md, docs/UPSTREAM.md, README.md.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at ed38648. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
layer
subsystem
All 1 allowed tools
Read Edit Write Bash
Other metadata
compatibility
Cocos AIR source checkout or installed cocosair.js package. Browser rendering requires WebGL 2; source tooling requires Node.js >=18. Use the host-provided tools and user-authorized workspace.
when_to_use
[
  "createAirApp rejects options or fails startup",
  "replace or release the running scene",
  "app closed and will not restart",
  "fit a container or set design resolution",
  "lost context or scene cleanup stalls"
]
owns
[
  "startup-admission",
  "app-lifecycle",
  "screen-sizing",
  "context-health",
  "session-cleanup"
]
not_for
[
  "package imports or page shell -> cocosair-project-setup",
  "persistent SceneStack pages -> cocosair-input-action",
  "live-session inspection -> cocosair-agent-session"
]
metadata
{
  "author": "oahc09@gmail.com",
  "version": "1.0.0",
  "last-updated": "2026-10-13",
  "description_zh": "配置 createAirApp 和应用生命周期、屏幕尺寸、会话清理及 WebGL 上下文健康。用于启动错误、场景替换、关闭和自定义 canvas。"
}

README badge

README badge for oahc09/cocosairjs/cocosair-application