Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm의 storage 관련 #47

Closed
ruby-textark opened this issue Oct 17, 2022 · 2 comments · Fixed by #48
Closed

wasm의 storage 관련 #47

ruby-textark opened this issue Oct 17, 2022 · 2 comments · Fixed by #48
Labels
enhancement New feature or request frontend:wasm Something about wasm frontend

Comments

@ruby-textark
Copy link

erars-wasm에서 저장을 위해 현재 브라우저의 LocalStorage를 사용하는 것으로 알고 있습니다.

다만 erars의 작업은 동기로 실행되고 있는데, 이럴 경우 메인 스레드가 블러킹될 수 있어 erars-wasm을 Worker로 사용하는 것이 바람직한 사용법 같습니다.
그런데 Worker에서는 localStorage를 사용할 수가 없어서, Worker를 통해 wasm을 로드하면 오류가 발생합니다.

가능하면 erars-wasm이 localStorage 대신 IndexedDB를 이용하도록 바꿀 수 있을까요?

image

@Riey Riey added enhancement New feature or request frontend:wasm Something about wasm frontend labels Oct 17, 2022
@Riey
Copy link
Owner

Riey commented Oct 17, 2022

가능은 한데 전체 구조를 좀 갈아엎어야 할거 같아서 상당히 걸립니다.

@Riey Riey mentioned this issue Oct 17, 2022
@Riey Riey closed this as completed in #48 Oct 17, 2022
@Riey
Copy link
Owner

Riey commented Oct 17, 2022

이제 기본 async고 상호작용은 콜백으로 합니다.

/* tslint:disable */
/* eslint-disable */
/**
*/
export function init_logger(): void;

interface ISystemCallbacks {
    input: (console: any) => Promise<number | string>;
    redraw: (console: any) => Promise<void>;

    load_local: (idx: number) => Promise<string | null>;
    load_global: () => Promise<string | null>;
    save_local: (idx: number, sav: string) => Promise<void>;
    save_global: (sav: string) => Promise<void>;
    remove_local: (idx: number) => Promise<void>;
}


/**
*/
export class ErarsContext {
  free(): void;
/**
* @param {Uint8Array} era_file
* @param {string} config_text
* @param {ISystemCallbacks} callbacks
*/
  constructor(era_file: Uint8Array, config_text: string, callbacks: ISystemCallbacks);
/**
* @returns {Promise<boolean>}
*/
  run(): Promise<boolean>;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend:wasm Something about wasm frontend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants