Guide: Create Your First Plugin
Guide: Create Your First Plugin
This guide creates a minimal plugin and runs one frame.
1. Define Plugin
import { AppBuilder } from 'qti-clockwork-app'
const ExamplePlugin = {
id: 'example',
version: '1.0.0',
init(app) {
app.resources.insert('example-config', { enabled: true })
},
shutdown() {
// cleanup
}
}
2. Register and Build
const app = new AppBuilder().use(ExamplePlugin).build()
3. Run and Step
app.run()
await app.step(1 / 60)
await app.shutdown()
4. Add a System
Inside init(app):
app.systems.add('Update', {
id: 'example.update',
stage: 'Update',
order: 100,
reads: [],
writes: [],
execute(ctx) {
void ctx
}
})
5. Validate
Run:
npm test
npm run typecheck