From fca1fa0d254dac8ea147c56bd7f29ca9d772e285 Mon Sep 17 00:00:00 2001 From: dcode Date: Sat, 30 Oct 2021 11:26:47 +0200 Subject: [PATCH] Add various instructions --- README.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6b9032b..5767fd3 100644 --- a/README.md +++ b/README.md @@ -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):
+ `https://cdn.jsdelivr.net/gh/dcodeIO/long.js@TAG/index.js` (ESM) + * From npm via [jsDelivr](https://www.jsdelivr.com):
+ `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):
+ `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 ---