Comments (1)
Found the answer at https://reference.wolfram.com/language/WolframNotebookEmbedder/examples/
This issue can close.
Here is my working code saved as demo.html
<script crossorigin src="https://unpkg.com/[email protected]"></script>
<p>
Enter the URL of a cloud object:
<input id="path" style="width:300px" value="https://www.wolframcloud.com/obj/jpoeschko/Public/Example.nb" />
<button onclick="embedNotebook()">Embed Notebook</button>
</p>
<p>
If the notebook's last cell contains a <code>Manipulate</code> with a variable <code>x</code>, this will reset it to 0:
<button onclick="resetX()">Reset <code>x</code></button>
</p>
<div id="container"></div>
<script>
let embedding = null;
function embedNotebook() {
const url = document.getElementById('path').value;
embedding = WolframNotebookEmbedder.embed(url, document.getElementById('container'), {allowInteract: true});
}
function resetX() {
if (embedding) {
embedding.then(nb => {
nb.getCells().then(({cells}) => {
if (cells) {
const lastCell = cells[cells.length - 1];
return nb.setDynamicModuleVariable({
cellId: lastCell.id,
name: 'x$$',
value: 0
});
}
})
})
}
}
</script>
from wolfram-notebook-embedder.
Related Issues (15)
- Punctuation rendering is abnormal HOT 1
- Method to generate /statichtml/ version of the current state of the embedded notebook HOT 1
- When I republish a notebook, it is not updated in the embed HOT 2
- Documentation of JSON expression representation HOT 4
- Webpack v4 jsonpFunction conflict HOT 2
- Improve package loading compatibility in documentation HOT 3
- evaluation events vs. manipulate
- DynamicModule variables names convention HOT 1
- css selectors for styling sections/subsections etc?
- Can't capture 'Rejected unsafe expression'
- getDynamicModuleVariable bug? HOT 3
- Side effect of unsafe values in setDynamicModuleVariable
- Embedding non-public notebooks? HOT 1
- Method to get all available DynamicModule variables? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wolfram-notebook-embedder.