Comparing version 0.0.17 to 0.0.18
{ | ||
"name": "create-oc", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "", |
@@ -29,3 +29,3 @@ { | ||
"devDependencies": { | ||
"oc-server": "^0.4.0", | ||
"oc-server": "^0.4.1", | ||
"oc-template-elm-compiler": "^0.4.0", | ||
@@ -32,0 +32,0 @@ "elm": "^0.19.1-6", |
@@ -27,5 +27,5 @@ { | ||
"devDependencies": { | ||
"oc-server": "^0.4.0", | ||
"oc-server": "^0.4.1", | ||
"oc-template-es6-compiler": "^4.1.0" | ||
} | ||
} |
@@ -6,20 +6,18 @@ import { InitialData, serverClient } from 'oc-server'; | ||
const onLoad = (cb: () => void) => { | ||
const onRender = (cb: (element: HTMLElement) => void) => { | ||
const { id } = getSettings(); | ||
window.oc.events.on('oc:rendered', (e, data) => { | ||
if (data.id === id) { | ||
cb(); | ||
cb(document.querySelector(`[id="${id}"]`)!); | ||
} | ||
}); | ||
}; | ||
const funFactSelector = Math.floor(Math.random() * 9999999999); | ||
export default ({ firstName, lastName, hobbies, born }: InitialData) => { | ||
onLoad(() => { | ||
document | ||
onRender((element) => { | ||
element | ||
.querySelector(`.${styles.button}`) | ||
?.addEventListener('click', async () => { | ||
const { funFact } = await serverClient.funFact({ year: born }); | ||
document.querySelector(`[id="${funFactSelector}"]`)!.innerHTML = | ||
funFact; | ||
element.querySelector('#fun-year-fact')!.innerHTML = funFact; | ||
}); | ||
@@ -40,3 +38,3 @@ }); | ||
</div> | ||
<div id="${funFactSelector}"></div> | ||
<div id="fun-year-fact"></div> | ||
<button class=${styles.button}> | ||
@@ -43,0 +41,0 @@ Fun year fact |
@@ -37,3 +37,3 @@ { | ||
"jsdom": "^21.1.1", | ||
"oc-server": "^0.4.0", | ||
"oc-server": "^0.4.1", | ||
"oc-template-preact-compiler": "^0.5.0", | ||
@@ -40,0 +40,0 @@ "preact": "^10.13.2", |
@@ -37,3 +37,3 @@ { | ||
"jsdom": "^21.1.1", | ||
"oc-server": "^0.4.0", | ||
"oc-server": "^0.4.1", | ||
"oc-template-react-compiler": "^6.2.0", | ||
@@ -40,0 +40,0 @@ "react": "18.2.0", |
@@ -36,4 +36,4 @@ { | ||
"jsdom": "^21.1.1", | ||
"oc-server": "^0.4.0", | ||
"oc-template-solid-compiler": "^0.8.0", | ||
"oc-server": "^0.4.1", | ||
"oc-template-solid-compiler": "^0.8.1", | ||
"solid-js": "^1.8.7", | ||
@@ -40,0 +40,0 @@ "typescript": "5.0.2", |
@@ -36,3 +36,3 @@ { | ||
"jsdom": "^21.1.1", | ||
"oc-server": "^0.4.0", | ||
"oc-server": "^0.4.1", | ||
"oc-template-vue-compiler": "^0.3.0", | ||
@@ -39,0 +39,0 @@ "typescript": "5.0.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
382415
924