Platform
Resources
Pricing
Sign in
Get started
Andrew Wooldridge
📜JavaScript developer. 🐲RPG fan. 📚Storyteller and 🕹game developer. 👨Father and Husband.
Workspace
Fork
Published
2 collections
By
Andrew Wooldridge
Edited
Mar 2, 2022
MIT
4 stars
1
Insert cell
Insert cell
Insert cell
Insert cell
myModule
=
import
(
await
FileAttachment
(
"test_export.js"
)
.
url
(
)
)
Insert cell
Insert cell
canvas
=
html
`<canvas></canvas>`
Insert cell
output
=
html
`<div></div>`
Insert cell
{
output
.
innerHTML
=
JSON
.
stringify
(
myModule
.
draw
(
canvas
.
getContext
(
'2d'
)
,
20
,
1
,
1
,
"red"
)
)
// using the draw method from imported module
myModule
.
draw
(
canvas
.
getContext
(
'2d'
)
,
30
,
10
,
10
,
color
)
}
Insert cell
viewof
color
=
Inputs
.
color
(
{
label
:
"Favorite color"
,
value
:
"#4682b4"
}
)
Insert cell
<
div
>
<
b
>
Output:
</
b
>
${output}
</
div
>
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Listed in...
Tips and Utilities
Andrew Wooldridge
JavaScript Tips
Andrew Wooldridge
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
myModule
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
canvas
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
output
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
color
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML