Skip to content

Commit

Permalink
Merge pull request #362 from sgoodrow-zymergen/master
Browse files Browse the repository at this point in the history
docs: update readme and types to reflect alternate wasm loading path
  • Loading branch information
MichelML authored Aug 2, 2023
2 parents 488c312 + 0898938 commit 1701f14
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ Once you have the RDKit package installed in your node modules, copy the followi
- `node_modules/@rdkit/rdkit/dist/RDKit_minimal.js`
- `node_modules/@rdkit/rdkit/dist/RDKit_minimal.wasm`

**NOTE: Both files must be copied at the same location in your deployed assets for the library to work properly.**
**NOTE: By default, both files must be copied at the same location in your deployed assets for the library to work properly.**. If you need the `RDKIT_minimal.wasm` file to be loaded from another location, use the `locateFile` option when invoking `initRDKitModule`.

```js
// Load the RDKit WASM module from a specific path on your server.
window.initRDKitModule({ locateFile: () => '/path/to/RDKit_minimal.wasm' }).then();
```

#### Option 2: Use the remote distribution files from [unpkg.com](https://unpkg.com/)

Expand Down
9 changes: 8 additions & 1 deletion typescript/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,18 @@ export interface RDKitModule {
use_legacy_stereo_perception(value: boolean): void;
}

type RDKitLoaderOptions = {
/**
* Optional path to the RDKit module .wasm file on your server.
*/
locateFile?: () => string
}

/**
* Loads the RDKit module asynchronously.
* In order to use the RDKit module, calling this function is necessary.
*/
export type RDKitLoader = () => Promise<RDKitModule>;
export type RDKitLoader = (options: RDKitLoaderOptions) => Promise<RDKitModule>;

declare global {
interface Window {
Expand Down

0 comments on commit 1701f14

Please sign in to comment.