-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ | |
/* Routes */ | ||
routes: { | ||
"/" : function (params) { | ||
editor.pageData.page = 'home' | ||
editor.pageData.page = 'hello' | ||
} | ||
|
||
} | ||
|
@@ -83,7 +83,20 @@ <h1>This is an App</h1> | |
<!-- /Page HTML templates --> | ||
</div> | ||
<script src="js/simply.everything.js"></script> | ||
<script src="js/simply-edit.js" data-api-key="muze"></script> | ||
<script> | ||
window.waitForImport = { | ||
init : () => true, | ||
save : () => true, | ||
load : function(callback) { | ||
window.addEventListener("simply-import-fired", () => { | ||
callback("{}"); | ||
}) | ||
}, | ||
connect: () => true, | ||
disconnect: () => true | ||
} | ||
</script> | ||
<script src="js/simply-edit.js" data-api-key="muze" data-simply-storage="waitForImport"></script> | ||
<script> | ||
/* Transformers */ | ||
editor.transformers = { | ||
|
@@ -106,6 +119,36 @@ <h1>This is an App</h1> | |
}); | ||
</script> | ||
<!-- Foot HTML --> | ||
<!-- importFoot --> | ||
<script type="module"> | ||
import dc from 'https://cdn.jsdelivr.net/gh/potherca-blog/[email protected]/index.js' | ||
|
||
document.body.insertAdjacentHTML('beforeend', dc.componentTemplates) | ||
document.body.querySelector("[data-simply-field=page]").insertAdjacentHTML('beforeend', dc.pageTemplates); | ||
|
||
// We need to make sure that both simplyApp _and_ dc[...] are loaded. | ||
// Race conditions caused by network transport need to be mitigated... | ||
|
||
/** | ||
* @CHECKME: De we want routes? This is a new APP, do components even have routes? | ||
*/ | ||
function importActionsAndCommands(simplyApp, dc) { | ||
Object.entries(dc.simplyApp.actions).forEach(([index,action]) => { | ||
simplyApp.actions[index] = action | ||
}) | ||
|
||
Object.entries(dc.simplyApp.commands).forEach(([index,command]) => { | ||
simplyApp.commands[index] = command | ||
}) | ||
} | ||
|
||
window.addEventListener("simply-content-loaded", () => { | ||
importActionsAndCommands(simplyApp, dc) | ||
}) | ||
|
||
// @CHECKME: Should we fire at the window or at the document? Why? | ||
editor.fireEvent('simply-import-fired', window) | ||
</script> | ||
|
||
<!-- /Foot HTML --> | ||
</body> | ||
|