Skip to content

Commit

Permalink
doc: update readme to explain #50
Browse files Browse the repository at this point in the history
  • Loading branch information
hungtcs committed May 24, 2022
1 parent 5a698c6 commit 720ebac
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,22 @@ mxGraph Typescript Declarations For [Official mxGraph NPM Package][mxgraph].
```ts
// src/mxgraph.ts
import factory from 'mxgraph';

declare global {
interface Window {
mxBasePath: string;
mxLoadResources: boolean;
mxForceIncludes: boolean;
mxLoadStylesheets: boolean;
mxResourceExtension: string;
}
}

(window as any)['mxBasePath'] = 'assets/mxgraph';
window.mxBasePath = 'assets/mxgraph';
window.mxLoadResources = true;
window.mxForceIncludes = false;
window.mxLoadStylesheets = true;
window.mxResourceExtension = '.txt';

export default factory({
// not working see https://github.com/jgraph/mxgraph/issues/479
Expand Down Expand Up @@ -79,6 +93,17 @@ mxGraph Typescript Declarations For [Official mxGraph NPM Package][mxgraph].

}
```

There a known issues is https://github.com/typed-mxgraph/typed-mxgraph/issues/50 the error message may look similar to

```
Uncaught TypeError: Cannot set properties of undefined (setting 'mxBasePath')
```

For detailed reasons, please refer to:

- https://github.com/typed-mxgraph/typed-mxgraph/issues/50#issuecomment-1114008885
- and https://github.com/typed-mxgraph/typed-mxgraph/issues/50#issuecomment-1120176914

Demos:
- https://github.com/typed-mxgraph/typed-mxgraph-example-bundled-with-rollup
Expand Down

0 comments on commit 720ebac

Please sign in to comment.