Skip to content

Commit

Permalink
Merge pull request #27 from FlowFuse/ZJvandeWeg-patch-1
Browse files Browse the repository at this point in the history
docs: script later is module too
  • Loading branch information
Steve-Mcl committed May 1, 2024
2 parents 6182adc + 28a6124 commit ab2beee
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ To scroll the container horizontally, use the mouse wheel + <kbd>Shift</kbd> key
<div id="nr-flow-1" class="flow-renderer" style="height: 300px"></div>
```

```javascript
const renderer = new FlowRenderer()
const container1 = document.getElementById('nr-flow-1');
const flow = [{"id": "1001", "type": "inject", "x": 100, "y": 40, "wires": [["1002"]]}, {"id": "1002", "type": "debug", "x":300, "y": 40}]
renderer.renderFlows(flow, { container: container1 })
```html
<script type="module">
const renderer = new FlowRenderer()
const container1 = document.getElementById('nr-flow-1');
const flow = [{"id": "1001", "type": "inject", "x": 100, "y": 40, "wires": [["1002"]]}, {"id": "1002", "type": "debug", "x":300, "y": 40}]
renderer.renderFlows(flow, { container: container1 })
</script>
```

### Inline Options example
Expand All @@ -72,11 +74,13 @@ NOTE: To SET and option, the data attribute can simply be present on the contain
></div>
```

```javascript
const renderer = new FlowRenderer()
const container2 = document.getElementById('nr-flow-2');
const flow = [{"id": "1001", "type": "inject", "x": 100, "y": 40, "wires": [["1002"]]}, {"id": "1002", "type": "debug", "x":300, "y": 40}]
renderer.renderFlows(flow, { container: container2 })
```html
<script type="module">
const renderer = new FlowRenderer()
const container2 = document.getElementById('nr-flow-2');
const flow = [{"id": "1001", "type": "inject", "x": 100, "y": 40, "wires": [["1002"]]}, {"id": "1002", "type": "debug", "x":300, "y": 40}]
renderer.renderFlows(flow, { container: container2 })
</script>
```


Expand Down

0 comments on commit ab2beee

Please sign in to comment.