mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
script marko-init
|
|
---
|
|
var markoWidgets = require('marko/widgets');
|
|
var componentsTemplate = require('./components.marko');
|
|
|
|
function componentsDataProvider(callback) {
|
|
componentsTemplate.renderToString({}, function(err, html, out) {
|
|
var widgetIds = markoWidgets.getRenderedWidgets(out);
|
|
|
|
// Serialize the HTML and the widget IDs to the browser
|
|
callback(null, {
|
|
html: html,
|
|
widgetIds: widgetIds
|
|
});
|
|
});
|
|
}
|
|
---
|
|
|
|
lasso-page dependencies=data.browserDependencies lasso=data.lasso
|
|
|
|
<!DOCTYPE html>
|
|
html lang="en"
|
|
head
|
|
meta charset="UTF-8"
|
|
title -- Marko Widgets Tests
|
|
lasso-head
|
|
body
|
|
await(components from componentsDataProvider)
|
|
script
|
|
---
|
|
window.components = ${JSON.stringify(components)};
|
|
---
|
|
|
|
div id="test"
|
|
div id="mocha"
|
|
div id="testsTarget"
|
|
|
|
lasso-body
|
|
|
|
lasso-slot name="mocha-run"
|
|
|
|
browser-refresh |