-
Go to google.com
-
Install
use-m
:const { use } = await import("https://esm.sh/use-m");
-
Use (import)
d3
:const d3 = await use('d3');
-
Clean page's body:
document.body.innerHTML = '<svg></svg>';
-
Draw a curved arrow
const svg = d3.select("svg") .attr("width", "100%") .attr("height", "100%") .attr("viewBox", "0 0 220 220"); svg.append("defs").append("marker") .attr("id", "arrow") .attr("markerWidth", 20) .attr("markerHeight", 20) .attr("refX", 10) .attr("refY", 6) .attr("orient", "auto") .append("path") .attr("d", "M0,0 L0,12 L12,6 Z") .attr("fill", "white"); svg.append("path") .attr("d", "M10,10 Q100,200 200,10") .attr("stroke", "white") .attr("fill", "none") .attr("marker-end", "url(#arrow)");
-
Install
use-m
:yarn init yarn add use-m
or
npm init npm i use-m
-
Create a file named
example.mjs
import { use } from 'use-m'; /** @type {import('lodash')} */ const _ = await use('[email protected]'); console.log(`_.add(1, 2) = ${_.add(1, 2)}`);
-
Type
_.
and see the list of available members of_
.