@xerakt/nomodule
v0.1.0-alpha.0
Published
DOM rendering library
Readme
xerakt (nomodule bundle)
DOM rendering library
[!NOTE]
this is nomodule bundle;the ES module bundle is here: https://www.npmjs.com/package/xerakt
this is a package that adds xerakt exports as window properties;
this package's main script (nomodule.js - specified in the "main" field in the package.json) is a single file bundle and doesn't use ES modules, so it can be used (as <script src="path/to/this/package/nomodule.js"></script>) for supporting old browsers;
e. g.:
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/@xerakt/[email protected]/nomodule.js"></script>
</head>
<body>
<div id="root"></div>
<script>
var root = document.getElementById("root");
function MyApp() {
var stateHookArr = useState(true);
var state = stateHookArr[0];
var setState = stateHookArr[1];
useEffect(
function () {
setInterval(
function () {
setState(
function (oldState) {
return !oldState;
}
)
},
200
);
}
);
return {
tag: "h1",
style: {
backgroundColor: "#f7df1e",
},
child: "Hello, world" + (state ? "!" : ""),
};
};
var docFragment = xerakt(MyApp);
root.appendChild(docFragment);
</script>
</body>
</html>readme of xerakt: https://github.com/xerakt/xerakt#readme
source code of xerakt: https://github.com/xerakt/xerakt
bundled with: https://github.com/xerakt/xerakt-generate-packages
