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.

referencesquick-start.md

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

Derived from the cocosair-application skill and its canonical docs/source pointers; reorganized on 2026-10-11. Source annotations below identify repository inputs, not files guaranteed to ship to npm consumers.

Environment: the HTML examples using /build/ require the AIR development server and an existing bundle. In npm applications use the installed package name and the application's own bundler/server; resolve docs and declarations from that package. Do not copy repository URLs into a consumer app. Browser behavior is verified only for explicitly tested snippets and candidates.

Quick Start

<canvas id="GameCanvas"></canvas>
<script type="importmap">
  { "imports": { "cocosair": "/build/cocosair.module.js" } }
</script>
<script type="module">
  import { createAirApp, Scene, ResolutionPolicy } from 'cocosair'; // page alias, not the package name
  const app = await createAirApp({
    canvas: '#GameCanvas', // HTMLCanvasElement | CSS selector string
    pixelRatioCap: 2, // effective DPR = min(devicePixelRatio, cap)
    designResolution: { width: 978, height: 846, policy: ResolutionPolicy.EXACT_FIT }, // 0..4
  });
  app.run(new Scene('Main'));
  app.getScene(); // Scene | null
  app.contextHealth.snapshot().state; // healthy | lost | restoring | failed
  const receipt = app.close ? await app.close() : null; // optional interface member; guard it in JS (no `!` in a module script)
  // once the registry-owning app closes, every createAirApp in this document rejects with AIR_E_APP_CLOSED
</script>

createAirApp(options) returns Promise<AirApp>; run(scene) returns void; the line-level declaration inventory lives in app-options.md (Public surface and evidence status). releaseScene?() and close?() are declared optional for older custom handles, so call them as app.close!() in strict TypeScript or guard them. For a custom canvas id, or options that must land before the engine module evaluates, use the cocosair.js entry: it writes globalThis.__CC_CANVAS__ and __CCDPR_CAP__ and only then dynamically imports the engine (src/air/safe-bootstrap.ts:11-18). Page shell, entry choice and importmap alias ownership - the cocosair alias above versus the cocosair.js package name used in code samples - belong to cocosair-project-setup.

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