From 1e069b42d58f33518e628f54621be95c91a48b31 Mon Sep 17 00:00:00 2001 From: James Milner Date: Tue, 19 Sep 2023 02:56:19 +0100 Subject: [PATCH] chore: document how to use terra draw with a script tag --- guides/GETTING_STARTED.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/guides/GETTING_STARTED.md b/guides/GETTING_STARTED.md index 80decf68..69b44b6a 100644 --- a/guides/GETTING_STARTED.md +++ b/guides/GETTING_STARTED.md @@ -13,11 +13,30 @@ npm install terra-draw Be aware Terra Draw is currently in alpha, the initial API is still being finalised. It is strongly advised to pin your installation to a specific version i.e. not using carat, asterix or tilde for versions but giving a version explicitly in your `package.json` ``` - "terra-draw": "0.0.1-alpha.22" + "terra-draw": "0.0.1-alpha.47" ``` Once terra-draw is out of alpha this suggestion will be removed as we will aim to move to semantic versioning. +## Script Tag + +Some people may want to experiment with using Terra Draw without a build step. To do this you can use the UMD bundle that is put onto npm via a CDN like unpkg. For example if we were using Terra Draw with MapLibre we might do something like this in our `` tag: + +```html + + + +``` + +Later on in our JavaScript code we can access the global `terraDraw` like so: + +```javascript + const td = new terraDraw.TerraDraw({ + adapter: new terraDraw.TerraDrawMapLibreGLAdapter({ map }), + modes: [new terraDraw.TerraDrawRectangleMode()] + }); +``` + ## API Docs You can find the full autogenerated [API docs on the terra draw website](https://terradraw.io/#/api)