From: Ardis Lu Date: Wed, 22 Feb 2023 07:48:19 +0000 (-0800) Subject: Add examples for dynamic import X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=b8948d3168af19f371d597247b6456a70c2750d3;p=sleepy-operators Add examples for dynamic import --- diff --git a/README.md b/README.md index 4813c57..62b5349 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,20 @@ Import the module: import * as sleepy from 'https://cdn.jsdelivr.net/gh/ardislu/sleepy-operators/sleepy-operators.js'; ``` -Or import individual functions: +Import individual functions: ```javascript import { sort, sum } from 'https://cdn.jsdelivr.net/gh/ardislu/sleepy-operators/sleepy-operators.js'; ``` + +Dynamically import the module: + +```javascript +const sleepy = await import('https://cdn.jsdelivr.net/gh/ardislu/sleepy-operators/sleepy-operators.js'); +``` + +Dynamically import individual functions: + +```javascript +const { sort, sum } = await import('https://cdn.jsdelivr.net/gh/ardislu/sleepy-operators/sleepy-operators.js'); +```