cayo 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/codegen.js +4 -2
- package/package.json +1 -1
- package/test/src/index.js +7 -1
package/lib/codegen.js
CHANGED
|
@@ -45,7 +45,9 @@ export function generateCayoRuntime(components, config) {
|
|
|
45
45
|
function generateRender(contents) {
|
|
46
46
|
return (
|
|
47
47
|
`
|
|
48
|
-
export default function render() {
|
|
48
|
+
export default function render(cb) {
|
|
49
|
+
var target = function (node) { return node; }
|
|
50
|
+
if (cb) target = cb;
|
|
49
51
|
${contents}
|
|
50
52
|
}
|
|
51
53
|
`
|
|
@@ -68,7 +70,7 @@ export function generateComponentInstance(cayoId, componentName) {
|
|
|
68
70
|
return (
|
|
69
71
|
`
|
|
70
72
|
new ${componentName}({
|
|
71
|
-
target: document.querySelector('[data-cayo-id="${cayoId}"]'),
|
|
73
|
+
target: target(document.querySelector('[data-cayo-id="${cayoId}"]')),
|
|
72
74
|
hydrate: true,
|
|
73
75
|
props: getProps('${cayoId}'),
|
|
74
76
|
});
|
package/package.json
CHANGED
package/test/src/index.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
// console.log("I'm main");
|
|
2
|
+
|
|
3
|
+
const cb = (node) => {
|
|
4
|
+
console.log('im side effecting');
|
|
5
|
+
console.log(node);
|
|
6
|
+
return node;
|
|
7
|
+
}
|
|
2
8
|
import { default as renderComponents } from './cayo-runtime.js';
|
|
3
9
|
document.addEventListener('DOMContentLoaded', () => {
|
|
4
|
-
renderComponents();
|
|
10
|
+
renderComponents(cb);
|
|
5
11
|
});
|