dsh-hyperframes 0.11.7 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/client.js +1780 -112
- package/lib/media-workbench.js +15 -4
- package/lib/skill-bundle.d.ts +1 -0
- package/lib/skill-bundle.js +1 -0
- package/package.json +1 -1
package/lib/media-workbench.js
CHANGED
|
@@ -470,11 +470,12 @@ export class MediaWorkbench {
|
|
|
470
470
|
}
|
|
471
471
|
export function installMediaWorkbench(ctx, engine) {
|
|
472
472
|
const workbench = new MediaWorkbench(engine);
|
|
473
|
+
const disposers = [() => workbench.dispose()];
|
|
473
474
|
ctx.inject?.(['connection'], (host) => {
|
|
474
|
-
host.connection?.fetch?.register({ path: workbench.route, methods: ['GET', 'POST'], requestBody: 'buffered', fetch: (request) => workbench.fetch(request) });
|
|
475
|
-
host.connection?.fetch?.register({ path: workbench.route + '/upload', methods: ['POST'], requestBody: 'streaming', fetch: (request) => workbench.fetch(request) });
|
|
475
|
+
const r1 = host.connection?.fetch?.register({ path: workbench.route, methods: ['GET', 'POST'], requestBody: 'buffered', fetch: (request) => workbench.fetch(request) });
|
|
476
|
+
const r2 = host.connection?.fetch?.register({ path: workbench.route + '/upload', methods: ['POST'], requestBody: 'streaming', fetch: (request) => workbench.fetch(request) });
|
|
477
|
+
host.effect?.(() => () => { r2?.(); r1?.(); });
|
|
476
478
|
});
|
|
477
|
-
ctx.on?.('dispose', () => workbench.dispose());
|
|
478
479
|
for (const action of ['project', 'render']) {
|
|
479
480
|
const dispose = ctx.tools?.register({
|
|
480
481
|
name: engine + '_' + action,
|
|
@@ -518,7 +519,17 @@ export function installMediaWorkbench(ctx, engine) {
|
|
|
518
519
|
},
|
|
519
520
|
});
|
|
520
521
|
if (typeof dispose === 'function')
|
|
521
|
-
|
|
522
|
+
disposers.push(dispose);
|
|
522
523
|
}
|
|
524
|
+
let cleaned = false;
|
|
525
|
+
const cleanup = () => {
|
|
526
|
+
if (cleaned)
|
|
527
|
+
return;
|
|
528
|
+
cleaned = true;
|
|
529
|
+
for (const fn of disposers.splice(0).reverse())
|
|
530
|
+
fn();
|
|
531
|
+
};
|
|
532
|
+
ctx.effect?.(() => cleanup);
|
|
533
|
+
ctx.on?.('dispose', cleanup);
|
|
523
534
|
return workbench;
|
|
524
535
|
}
|
package/lib/skill-bundle.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface SkillsPluginContext {
|
|
|
16
16
|
tools?: {
|
|
17
17
|
register(definition: Record<string, unknown>): () => void;
|
|
18
18
|
};
|
|
19
|
+
effect?(fn: () => () => void): unknown;
|
|
19
20
|
on?(event: string, listener: () => void): (() => void) | void;
|
|
20
21
|
logger?: {
|
|
21
22
|
warn(message: string): void;
|
package/lib/skill-bundle.js
CHANGED