Skip to content

Commit

Permalink
spell out "JavaScript" (instead of "JS") on all documentation pages
Browse files Browse the repository at this point in the history
  • Loading branch information
poeschko committed Jul 26, 2019
1 parent e4e4cc3 commit 657e5b6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ If you are using a package manager such as [npm](https://www.npmjs.com/get-npm)

npm install wolfram-notebook-embedder

and then import it in your JS code like so:
and then import it in your JavaScript code like so:

import WolframNotebookEmbedder from 'wolfram-notebook-embedder';

Expand Down
8 changes: 4 additions & 4 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ title: Getting Started
npm install wolfram-notebook-embedder
```
so you can import it in JS as
so you can import it in JavaScript as
```js
import WolframNotebookEmbedder from 'wolfram-notebook-embedder';
Expand All @@ -28,14 +28,14 @@ title: Getting Started
```html
<script crossorigin src="https://unpkg.com/[email protected]/dist/wolfram-notebook-embedder.min.js"></script>
```
3. In your HTML, create a container where you want the notebook to be rendered (say `<div id="notebookContainer"></div>`) and add the following JS code:
3. In your HTML, create a container where you want the notebook to be rendered (say `<div id="notebookContainer"></div>`) and add the following JavaScript code:
```js
var embedding = WolframNotebookEmbedder.embed('url', document.getElementById('notebookContainer'));
```
where `url` is the URL of your cloud object from step 1. More details about `embed` are described in the [library interface documentation](./LibraryInterface.md).
4. If you want to control the notebook from your JS code, wait for the `embed` result (a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)) to resolve, and then use various [Notebook API methods](./NotebookAPI.md):
4. If you want to control the notebook from your JavaScript code, wait for the `embed` result (a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)) to resolve, and then use various [Notebook API methods](./NotebookAPI.md):
```js
embedding.then(function (nb) {
Expand All @@ -50,5 +50,5 @@ title: Getting Started
});
})
```
5. If you want to serve static HTML from your server so the notebook can be rendered before JS code is loaded (which also helps with SEO), take a look at [server-side rendering](./ServerSideRendering.md).
5. If you want to serve static HTML from your server so the notebook can be rendered before JavaScript code is loaded (which also helps with SEO), take a look at [server-side rendering](./ServerSideRendering.md).
6. If you run into any issues, take a look at the [troubleshooting guide](./Troubleshooting.md). If you think you found a bug, please report it.
2 changes: 1 addition & 1 deletion docs/LibraryInterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WolframNotebookEmbedder.embed(notebookURL, domNode, attributes)

* `notebookURL`: a string with a cloud object URL of the notebook to embed, e.g. `'https://www.wolframcloud.com/obj/4beadfbb-84dd-4b26-87b6-bcd30b9abd65'` or `'https://www.wolframcloud.com/obj/myusername/myfolder/mynotebook.nb'`
* `domNode`: a DOM node in which to render the notebook, e.g. obtained by `document.getElementById('myContainer')`
* `attributes `: a JS object with attributes
* `attributes `: a JavaScript object with attributes

The following attributes can be given:

Expand Down
4 changes: 2 additions & 2 deletions docs/NotebookAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ id: NotebookAPI
title: Notebook API
---

This is the documentation of [methods](#methods) on the object returned by [`embed`](./LibraryInterface.md) to control a notebook from JS code. Each method takes a JS object with *parameters* and returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises) resolving to a *response* object. Parameters with a default value (specified as "= `...`") are optional. In case of an error, the returned promise is rejected with a standard [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object with a `message` property; the potential error messages are listed for each command.
This is the documentation of [methods](#methods) on the object returned by [`embed`](./LibraryInterface.md) to control a notebook from JavaScript code. Each method takes a JavaScript object with *parameters* and returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises) resolving to a *response* object. Parameters with a default value (specified as "= `...`") are optional. In case of an error, the returned promise is rejected with a standard [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object with a `message` property; the potential error messages are listed for each command.

The API also exposes some [events](#events) that can be subscribed to using the API method `addEventListener(eventName, callback)`. The `callback` will receive a JS object with the specified *fields* as its single argument. Event listeners can be removed with `removeEventListener(eventName, callback)`. Some events are marked as *singular*, which means that they will usually fire exactly once, and an event listener added after they have already fired will still be executed (right away).
The API also exposes some [events](#events) that can be subscribed to using the API method `addEventListener(eventName, callback)`. The `callback` will receive a JavaScript object with the specified *fields* as its single argument. Event listeners can be removed with `removeEventListener(eventName, callback)`. Some events are marked as *singular*, which means that they will usually fire exactly once, and an event listener added after they have already fired will still be executed (right away).


## Methods
Expand Down
4 changes: 2 additions & 2 deletions docs/NotebookLoadingPhases.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ title: Notebook Loading Phases

## Rendering phases

Notebooks depend on various things that are loaded asynchronously, e.g. the actual notebook content, CSS, JS, fonts and (potentially) results from kernel evaluations. While things are loading, static pieces of HTML are rendered if available (see [server-side rendering](./ServerSideRendering.md)). Rendering generally goes through the following phases:
Notebooks depend on various things that are loaded asynchronously, e.g. the actual notebook content, CSS, JavaScript, fonts and (potentially) results from kernel evaluations. While things are loading, static pieces of HTML are rendered if available (see [server-side rendering](./ServerSideRendering.md)). Rendering generally goes through the following phases:

1. Nothing is displayed initially.
2. Once critical CSS and fonts are loaded: Static HTML is displayed, if available; the event `first-paint-done` with `{showingStaticHTML: true}` is fired.
3. Once the main JS code and notebook content data is loaded: Static HTML is reused as a whole (albeit in a slightly different container structure); the event `initial-render-progress` with `{cellsRendered: 0, cellsTotal: -1}` is fired.
3. Once the main JavaScript code and notebook content data is loaded: Static HTML is reused as a whole (albeit in a slightly different container structure); the event `initial-render-progress` with `{cellsRendered: 0, cellsTotal: -1}` is fired.
4. Once other dependencies, such as the notebook stylesheet, are loaded and notebook-level options are resolved (possibly relying on kernel evaluations): Static HTML for individual cells is rendered; the event `initial-render-progress` with `{cellsRendered: 0, cellsTotal: N}` is fired with the actual number `N` of initially visible cells. If no static HTML was available initially, the event `first-paint-done` is fired at this point. The notebook also starts fetching static HTML for cells that were not present in the initial static HTML.
5. Each cell might require additional dependencies (e.g. fonts), resolution of `Dynamic` option values, resolution of `Dynamic` content, etc. Once a cell becomes ready, it is "live-rendered", while other non-ready cells are still rendered using static HTML; the event `initial-render-progress` with `{cellsRendered: M, cellsTotal: N}` is fired accordingly.
6. Once all cells have been live-rendered: The event `initial-render-done` is fired.
Expand Down
2 changes: 1 addition & 1 deletion docs/ServerSideRendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: ServerSideRendering
title: Server-Side Rendering
---

In some cases, you might want to include (static) HTML for a notebook on your page so it can be rendered even before the necessary JavaScript code is loaded and executed. This reduces the time until the user sees the notebook, and it also helps search engines to index your notebook content. Once your JS code executes, you can [embed](./LibraryInterface.md) the notebook into the same container node, and it will transition seamlessly from the static view to "live" (interactive) rendering. The same happens on [www.wolframcloud.com](https://www.wolframcloud.com) as well.
In some cases, you might want to include (static) HTML for a notebook on your page so it can be rendered even before the necessary JavaScript code is loaded and executed. This reduces the time until the user sees the notebook, and it also helps search engines to index your notebook content. Once your JavaScript code executes, you can [embed](./LibraryInterface.md) the notebook into the same container node, and it will transition seamlessly from the static view to "live" (interactive) rendering. The same happens on [www.wolframcloud.com](https://www.wolframcloud.com) as well.

Static HTML is generated ("pre-rendered") for each cloud notebook whenever it is created or changed. You can access it through an HTTP API, by making a `GET` request to

Expand Down

0 comments on commit 657e5b6

Please sign in to comment.