Comments (6)
this is now fixed by #345 and should be available in next release
you may test it here: https://dev.livecodes.io
this code should now work as expected:
<div id="livecodes-qlbo5jm6qm">
<span>Open the project <a href="https://livecodes.io/?x=id/tse96fdpgz4" target="_blank">Untitled Project</a> in <a href="https://livecodes.io/" target="_blank">LiveCodes</a></span>
</div>
<script src="https://livecodes.io/sdk/livecodes.umd.js"></script>
<script>
const options = {
appUrl: 'https://dev.livecodes.io/',
params: {
languages: "pyodide",
autoupdate: false,
console: "full",
},
import: "id/tse96fdpgz4",
loading: "eager",
};
livecodes.createPlayground("#livecodes-qlbo5jm6qm", options);
</script>
@moonpiedumplings please let me know if that solves your problem.
from livecodes.
hi @moonpiedumplings ,
your imported project (id/tse96fdpgz4) already provides the configuration object, so your config settings are overridden.
To override project config, use params
<div id="livecodes-qlbo5jm6qm">
<span>Open the project <a href="https://livecodes.io/?x=id/tse96fdpgz4" target="_blank">Untitled Project</a> in <a href="https://livecodes.io/" target="_blank">LiveCodes</a></span>
</div>
<script src="https://livecodes.io/sdk/livecodes.umd.js"></script>
<script>
const options = {
params: {
languages: "pyodide",
autoupdate: false,
preview: false,
console: "full",
},
import: "id/tse96fdpgz4",
loading: "click",
};
livecodes.createPlayground("#livecodes-qlbo5jm6qm", options);
</script>
The result always runs when the playground is first loaded. autoupdate
determines what happens when the code changes. If you do not want to run the playground, you may use the embed option loading: "click"
.
The params.preview
option allows showing a faded preview of the html page behind the "click to load" screen. However, the script will still run before loading the playground. To prevent that, set it to false.
console: "full"
is what you are asking for.
from livecodes.
I probably need to add a config option autorun
to determine if the result page should run when the playground first loads.
also, the preview
option needs to be documented
from livecodes.
I probably need to add a config option
autorun
to determine if the result page should run when the playground first loads.
on a second thought, if autoupdate
is set to false
the result page should not run, even when playground first loads.
this will prevent the confusion of having 2 similar options with different meanings.
to handle the scenario of wanting to run the page once when the playground loads:
import { createPlayground } from 'livecodes';
const options = {
params: { autoupdate: false },
// other embed options
};
createPlayground("#container", options).then(playground => {
playground.run();
});
this is being addressed in #345 and should be available in next release
@moonpiedumplings thank you for reporting
from livecodes.
The
params.preview
option allows showing a faded preview of the html page behind the "click to load" screen. However, the script will still run before loading the playground. To prevent that, set it to false.
it is probably also not a good idea to have the preview page run by default, specially if the page sends alerts or starts sounds, etc.
from livecodes.
@moonpiedumplings I will close this as fixed.
If you still have a problem with this issue please feel free to re-open it.
from livecodes.
Related Issues (20)
- Please give env file HOT 3
- [not an issue] Amazing product. Would love to chat! HOT 1
- Hello! HOT 3
- can not load https://livecodes-sandbox.pages.dev/v4/compiler HOT 4
- Programmatic engine? HOT 10
- Keeping the scroll position after reload HOT 4
- npm install error HOT 1
- Unexpected identifier error for `npm start` HOT 5
- Adjust layout? HOT 3
- Feature: Swift WASM HOT 3
- Bug: npm install errors HOT 3
- Improve Julia language support
- Feature: Editor Themes HOT 7
- Feature: Global Themes HOT 3
- Bug: result-utils included in exported source HOT 8
- Feature: Export as module HOT 3
- Bug: build/index.html not getting patched with build hash HOT 3
- Feature: Allow use of modules with imports outside of livecodes HOT 2
- Feature: Fully offline export HOT 1
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 livecodes.