Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tomayac committed Dec 10, 2021
1 parent 03a0555 commit b2644d0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
52 changes: 28 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,34 @@ npm install --save esm-potrace-wasm
## Usage

```js
import { potrace, ready } from 'esm-potrace-wasm';

/**
* The `imageBitmapSource` parameter is an `ImageBitmapSource`, that is any of:
* - `HTMLImageElement`
* - `SVGImageElement`
* - `HTMLVideoElement`
* - `HTMLCanvasElement`
* - `ImageData`
* - `ImageBitmap`
* - `Blob`
*/
await ready();
const svg = await potrace(
imageBitmapSource,
(options = {
turdsize: 2,
turnpolicy: 4,
alphamax: 1,
opticurve: 1,
opttolerance: 0.2,
pathonly: false,
})
);
import { potrace, init } from 'esm-potrace-wasm';

(async () => {
// Initialize the module once.
await init();

/**
* The `imageBitmapSource` parameter is an `ImageBitmapSource`, that is any of:
* - `HTMLImageElement`
* - `SVGImageElement`
* - `HTMLVideoElement`
* - `HTMLCanvasElement`
* - `ImageData`
* - `ImageBitmap`
* - `Blob`
*/
const svg = await potrace(
imageBitmapSource,
(options = {
turdsize: 2,
turnpolicy: 4,
alphamax: 1,
opticurve: 1,
opttolerance: 0.2,
pathonly: false,
})
);
})();
```

## Developing
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "esm-potrace-wasm",
"version": "0.2.0",
"version": "0.2.1",
"description": "A modern ESM build of the Potrace library for use in the browser.",
"main": "./dist/index.min.js",
"browser": "./dist/index.min.js",
Expand Down

0 comments on commit b2644d0

Please sign in to comment.