feat(rust-provider): add cross-runtime Rust provider tests and docs; simplify bridge event handling and bump tstest
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartfs',
|
||||
version: '1.4.0',
|
||||
version: '1.5.0',
|
||||
description: 'a cross platform extendable fs module'
|
||||
}
|
||||
|
||||
@@ -168,14 +168,8 @@ export class SmartFsProviderRust implements ISmartFsProvider {
|
||||
}
|
||||
this.initialized = true;
|
||||
|
||||
// Set up watch event forwarding
|
||||
// The bridge emits events as 'management:<eventName>'
|
||||
// Watch events come as 'management:watch:<id>'
|
||||
const originalEmit = this.bridge.emit.bind(this.bridge);
|
||||
this.bridge.on = ((event: string, handler: (...args: any[]) => void) => {
|
||||
// Intercept watch events
|
||||
return (this.bridge as any).__proto__.on.call(this.bridge, event, handler);
|
||||
}) as any;
|
||||
// The bridge already inherits .on() from EventEmitter.
|
||||
// Watch events from Rust arrive as 'management:watch:<id>'.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user