Skip to content

Commit

Permalink
Add various instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Oct 30, 2021
1 parent d901220 commit fca1fa0
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions README.md
Expand Up @@ -29,16 +29,32 @@ Usage

The package exports an ECMAScript module with an UMD fallback.

```sh
$> npm install long
```

```js
import Long from "long";

var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);

console.log(longVal.toString());
var value = new Long(0xFFFFFFFF, 0x7FFFFFFF);
console.log(value.toString());
...
```

Note that mixing ESM and CommonJS is not recommended as it yield different classes with the same functionality.
Note that mixing ESM and CommonJS is not recommended as it yields different classes, albeit with the same functionality.

### Usage with a CDN

* From GitHub via [jsDelivr](https://www.jsdelivr.com):<br />
`https://cdn.jsdelivr.net/gh/dcodeIO/long.js@TAG/index.js` (ESM)
* From npm via [jsDelivr](https://www.jsdelivr.com):<br />
`https://cdn.jsdelivr.net/npm/long@VERSION/index.js` (ESM)
`https://cdn.jsdelivr.net/npm/long@VERSION/umd/index.js` (UMD)
* From npm via [unpkg](https://unpkg.com):<br />
`https://unpkg.com/long@VERSION/index.js` (ESM)
`https://unpkg.com/long@VERSION/umd/index.js` (UMD)

Replace `TAG` respectively `VERSION` with a [specific version](https://github.com/AssemblyScript/binaryen.js/releases) or omit it (not recommended in production) to use main/latest.

API
---
Expand Down

0 comments on commit fca1fa0

Please sign in to comment.