fix(core): Refactor and clean up class imports and exports

This commit is contained in:
2025-01-23 20:11:40 +01:00
parent 6332bf671a
commit c829b9c41e
6 changed files with 13 additions and 6 deletions

View File

@@ -0,0 +1,18 @@
import * as plugins from './plugins.js';
import { AsyncStore } from './classes.asyncstore.js';
export class AsyncContext {
private _context = new plugins.simpleAsyncContext.AsyncContext.Variable<AsyncStore>();
private _store = new AsyncStore();
get store() {
return this._context.get() || this._store;
}
set store(value: AsyncStore) {
this._store = value;
}
public async runScoped(functionArg: () => Promise<void>) {
await this._context.run(new AsyncStore(this.store), async () => {
await functionArg()
});
}
}