Skip to content

Emscripten wasm doesn't work as in ObservableHQ site #1033

Answered by mbostock
gganapat asked this question in Q&A
Discussion options

You must be logged in to vote

Observable Framework is just vanilla JavaScript and HTML, so you can just add a script tag as shown in the documentation:

<script src="https://coolprop-gani.s3.us-west-2.amazonaws.com/coolprop.js"></script>

If you then want to wait for the module to load, it looks like you can do something like this:

```js
if (!Module.onRuntimeInitialized) await new Promise((resolve) => (Module.onRuntimeInitialized = resolve));
const coolprop = Module;
```

Here’s a minimal example of using it:

```js
const fluid = "Xenon";
const temp = 25;
const psia_to_Pas = 6894.75729;
```

```js
Plot.plot({
  title: `Density of ${fluid} at ${temp}°C`,
  x: {label: "Pressure (psia)"},
  y: {label: "Density (kg/m³)"},
  m…

Replies: 6 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@gganapat
Comment options

Answer selected by mbostock
Comment options

You must be logged in to vote
5 replies
@gganapat
Comment options

@mbostock
Comment options

@gganapat
Comment options

@mbostock
Comment options

@gganapat
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn’t working
2 participants
Converted from issue

This discussion was converted from issue #1032 on March 10, 2024 02:07.