CoolFace
Apppublic

simplex5/sf-68d

sourceHugging Facemitupdated 3y agoView on Hugging Face
0likes
app.js33 linesDownload Raw Back to root
1import SafeteansLLM from './safeteans-llm';2 3class App {4 constructor({ el, data, methods, created }) {5    // Create the LLM instance6    this.llm = new SafeteansLLM();7 8    // Mount the root component9    this.render([{10      el: el,11      data: data,12      methods: methods,13      created: created,14    }]);15 }16 17 render({ el, data, methods, created }) {18    // Create the element19    const element = createElement(el);20 21    // Set the data and methods22    Object.keys(data).forEach(key => element.dataset[key] = data[key]);23    Object.keys(methods).forEach(key => element[key] = methods[key]);24 25    // Set the created callback26    if (created) created(element);27 28    // Append the element to the body29    document.body.appendChild(element);30 }31}32 33export default App;