-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[web] add function to retrieve WASM module
Summary: Making sure that module is now typed in Flow, and making it easier to retrieve the module (will be helpful in tests later). Depends on D8545 Test Plan: 1. `flow` 2. Check if result is still logged Reviewers: michal, tomek Reviewed By: michal Subscribers: ashoat Differential Revision: https://phab.comm.dev/D8547
- Loading branch information
Showing
3 changed files
with
29 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// @flow | ||
|
||
import Module from './_generated/comm-query-executor.js'; | ||
import type { EmscriptenModule } from './types/module.js'; | ||
import { DEFAULT_COMM_QUERY_EXECUTOR_FILENAME } from './utils/constants.js'; | ||
|
||
function getDatabaseModule( | ||
databaseModuleFilename?: ?string, | ||
databaseModuleFilePath?: string, | ||
): EmscriptenModule { | ||
const fileName = databaseModuleFilename | ||
? databaseModuleFilename | ||
: DEFAULT_COMM_QUERY_EXECUTOR_FILENAME; | ||
|
||
return Module({ | ||
locateFile: (path: string, prefix?: string) => { | ||
if (databaseModuleFilePath) { | ||
return `${databaseModuleFilePath}/${fileName}`; | ||
} | ||
return `${prefix ?? ''}${fileName}`; | ||
}, | ||
}); | ||
} | ||
|
||
export { getDatabaseModule }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters