@@ -19,7 +19,7 @@ The Engine orchestrates the entire system, managing:
1919** Usage:**
2020
2121``` javascript
22- import { Engine } from " ar.js-core" ;
22+ import { Engine } from ' ar.js-core' ;
2323
2424const engine = new Engine ();
2525engine .start (); // Start the game loop
@@ -38,8 +38,8 @@ Minimal Entity-Component-System implementation:
3838
3939``` javascript
4040const entityId = engine .ecs .createEntity ();
41- engine .ecs .setComponent (entityId, " Transform" , { x: 0 , y: 0 , z: 0 });
42- engine .ecs .setResource (" ProcessingConfig" , { threshold: 0.5 });
41+ engine .ecs .setComponent (entityId, ' Transform' , { x: 0 , y: 0 , z: 0 });
42+ engine .ecs .setResource (' ProcessingConfig' , { threshold: 0.5 });
4343```
4444
4545### Event Bus (` src/core/event-bus.js ` )
@@ -50,12 +50,12 @@ Lightweight publish-subscribe system for loose coupling:
5050
5151``` javascript
5252// Subscribe to events
53- engine .eventBus .on (" capture:ready" , (data ) => {
54- console .log (" Capture ready:" , data);
53+ engine .eventBus .on (' capture:ready' , (data ) => {
54+ console .log (' Capture ready:' , data);
5555});
5656
5757// Emit events
58- engine .eventBus .emit (" custom:event" , { message: " Hello" });
58+ engine .eventBus .emit (' custom:event' , { message: ' Hello' });
5959```
6060
6161### Plugin Manager (` src/core/plugin-manager.js ` )
@@ -66,20 +66,20 @@ Manages plugin registration, enabling, and disabling:
6666
6767``` javascript
6868// Register a plugin
69- engine .pluginManager .register (" my-plugin" , {
69+ engine .pluginManager .register (' my-plugin' , {
7070 async init (context ) {
71- console .log (" Plugin initialized" );
71+ console .log (' Plugin initialized' );
7272 },
7373 async dispose () {
74- console .log (" Plugin disposed" );
74+ console .log (' Plugin disposed' );
7575 },
7676 update (deltaTime , context ) {
7777 // Called each frame
7878 },
7979});
8080
8181// Enable the plugin
82- await engine .pluginManager .enable (" my-plugin" , engine .getContext ());
82+ await engine .pluginManager .enable (' my-plugin' , engine .getContext ());
8383```
8484
8585## Systems
@@ -91,7 +91,7 @@ Manages video/image capture from various sources:
9191** Usage:**
9292
9393``` javascript
94- import { CaptureSystem , SOURCE_TYPES } from " ar.js-core" ;
94+ import { CaptureSystem , SOURCE_TYPES } from ' ar.js-core' ;
9595
9696await CaptureSystem .initialize (
9797 {
@@ -154,21 +154,21 @@ Profiles:
154154** Usage:**
155155
156156``` javascript
157- import { defaultProfilePlugin } from " ./plugins/profile/default-policy.js" ;
157+ import { defaultProfilePlugin } from ' ./plugins/profile/default-policy.js' ;
158158
159159engine .pluginManager .register (defaultProfilePlugin .id , defaultProfilePlugin);
160160await engine .pluginManager .enable (defaultProfilePlugin .id , engine .getContext ());
161161
162162const profile = engine .ecs .getResource (RESOURCES .DEVICE_PROFILE );
163- console .log (" Device profile:" , profile .label );
163+ console .log (' Device profile:' , profile .label );
164164```
165165
166166## Component and Resource Keys
167167
168168Standardized keys are defined in ` src/core/components.js ` :
169169
170170``` javascript
171- import { COMPONENTS , RESOURCES , EVENTS } from " ar.js-core" ;
171+ import { COMPONENTS , RESOURCES , EVENTS } from ' ar.js-core' ;
172172
173173// Component keys (entity-specific)
174174COMPONENTS .TRACKING_TARGET ;
@@ -193,9 +193,9 @@ Plugins are simple objects with lifecycle methods:
193193
194194``` javascript
195195const myPlugin = {
196- id: " my-plugin" ,
197- name: " My Custom Plugin" ,
198- type: " custom" ,
196+ id: ' my-plugin' ,
197+ name: ' My Custom Plugin' ,
198+ type: ' custom' ,
199199
200200 // Called when plugin is enabled
201201 async init (context ) {
@@ -227,10 +227,10 @@ function mySystem(deltaTime, context) {
227227 const { ecs , eventBus } = context;
228228
229229 // Query entities with specific components
230- const entities = ecs .query (" Transform" , " Visible" );
230+ const entities = ecs .query (' Transform' , ' Visible' );
231231
232232 for (const entityId of entities) {
233- const transform = ecs .getComponent (entityId, " Transform" );
233+ const transform = ecs .getComponent (entityId, ' Transform' );
234234 // Process entity
235235 }
236236}
@@ -294,10 +294,10 @@ The legacy `Source` and `Profile` classes remain unchanged and continue to work
294294
295295``` javascript
296296// Legacy API (still works)
297- import { Source , Profile } from " ar.js-core" ;
297+ import { Source , Profile } from ' ar.js-core' ;
298298
299299// New ECS API
300- import { Engine , CaptureSystem } from " ar.js-core" ;
300+ import { Engine , CaptureSystem } from ' ar.js-core' ;
301301```
302302
303303Future versions may add adapters that allow the legacy classes to use the new ECS internals while maintaining the same external API.
@@ -309,39 +309,39 @@ Future versions may add adapters that allow the legacy classes to use the new EC
309309** Before:**
310310
311311``` javascript
312- import { Source } from " ar.js-core" ;
312+ import { Source } from ' ar.js-core' ;
313313
314314const source = new Source ({
315- sourceType: " webcam" ,
315+ sourceType: ' webcam' ,
316316 sourceWidth: 640 ,
317317 sourceHeight: 480 ,
318318});
319319
320320source .init (
321321 () => {
322- console .log (" Source ready" );
322+ console .log (' Source ready' );
323323 },
324324 (error ) => {
325- console .error (" Source error:" , error);
325+ console .error (' Source error:' , error);
326326 },
327327);
328328```
329329
330330** After:**
331331
332332``` javascript
333- import { Engine , CaptureSystem , SOURCE_TYPES } from " ar.js-core" ;
334- import { webcamPlugin } from " ./plugins/source/webcam.js" ;
333+ import { Engine , CaptureSystem , SOURCE_TYPES } from ' ar.js-core' ;
334+ import { webcamPlugin } from ' ./plugins/source/webcam.js' ;
335335
336336const engine = new Engine ();
337337engine .pluginManager .register (webcamPlugin .id , webcamPlugin);
338338
339- engine .eventBus .on (" capture:ready" , () => {
340- console .log (" Source ready" );
339+ engine .eventBus .on (' capture:ready' , () => {
340+ console .log (' Source ready' );
341341});
342342
343- engine .eventBus .on (" capture:init:error" , ({ error }) => {
344- console .error (" Source error:" , error);
343+ engine .eventBus .on (' capture:init:error' , ({ error }) => {
344+ console .error (' Source error:' , error);
345345});
346346
347347await CaptureSystem .initialize (
0 commit comments