observablehq / stdlib

The Observable standard library.
https://observablehq.com/@observablehq/standard-library
ISC License
966 stars 83 forks source link

Using DOM from Library #140

Closed menghaniryan closed 4 years ago

menghaniryan commented 4 years ago

I'm trying to use the Observable standard library to creatre a Bubble Chart.

I've added the following code at the top of my js file (I am working in React):

import {Library} from '@observablehq/stdlib/';

which is working correctly. However, I want to access the DOM functions from the Library. I do this by trying the following statement:

Library.DOM.uid("My stuff")

but I am getting an error that DOM is undefined. Am I using the Library incorrectly?

tmcw commented 4 years ago

Please check out the last section of the readme: you'll need to call new Library() to construct an instance.

menghaniryan commented 4 years ago

Wow, I didn't see the installation part of the README. Thanks so much!

amarder commented 3 weeks ago

Hmmm. When I do this I get TypeError: library.DOM is undefined.