mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-20 22:28:08 -05:00
- Remove `internal` export from index.web.ts (keep as local variable) - Use `yarn build:node && yarn build:browser` in build script - Remove unnecessary `node:` external from vite.browser.config.ts (Vite handles browser externalization automatically) https://claude.ai/code/session_01MnxRXLNjqXrVb5CdsC85Fb
26 lines
612 B
TypeScript
26 lines
612 B
TypeScript
import { init as initLootCore } from '@actual-app/core/server/main';
|
|
import type { InitConfig, lib } from '@actual-app/core/server/main';
|
|
|
|
export * from './methods';
|
|
export * as utils from './utils';
|
|
|
|
let internal: typeof lib | null = null;
|
|
|
|
export async function init(config: InitConfig = {}) {
|
|
internal = await initLootCore(config);
|
|
return internal;
|
|
}
|
|
|
|
export async function shutdown() {
|
|
if (internal) {
|
|
try {
|
|
await internal.send('sync');
|
|
} catch {
|
|
// most likely that no budget is loaded, so the sync failed
|
|
}
|
|
|
|
await internal.send('close-budget');
|
|
internal = null;
|
|
}
|
|
}
|