Ripple
The JS/TS SDK can be used directly in Ripple components without the need for any wrappers.
Installation
Please refer to the SDK installation section.
Usage
This is an example of using the LiveCodes JS SDK in a Ripple component:
App.ripple
import { createPlayground, type EmbedOptions, type Playground } from 'livecodes';
export default component App() {
const options: EmbedOptions = {
params: {
html: '<h1>Hello World!</h1>',
css: 'h1 {color: blue;}',
js: 'console.log("Hello, Ripple!")',
console: 'open',
},
};
let playground: Playground | null = null;
const onMount = (container: HTMLElement) => {
createPlayground(container, options).then((sdk) => {
playground = sdk; // now the SDK is available
});
return () => playground?.destroy();
};
<div {ref onMount}></div>
}
Embed options, SDK methods and TypeScript types are available as described in the JS/TS SDK documentations.