Getting started with liaison
liaison is a data binding library that aims for emerging web standards compatibility. It provides a basis of building your application having separation-of-concern (MV* style) in mind.
Start building your own MV* application
Install liaison
Start with installing node.js, then Bower. Bower lets you install liaison automatically.
$ npm install -g bower
$ mkdir -p app && cd $_
$ bower install liaison
$ vi index.html
For index.html, you can start with something like this:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="./bower_components/requirejs/require.js" data-main="./bower_components/"></script>
<script type="text/javascript">
require([
"liaison/wrapper",
"liaison/DOMTreeBindingTarget"
], function (wrapper, DOMTreeBindingTarget) {
function startup() {
document.querySelector("template").bind("bind", wrapper.wrap({
hello: "Hello!"
}));
}
document.body ? startup() : window.addEventListener("DOMContentLoaded", startup);
});
</script>
</head>
<body>
<template>
{{hello}} <input type="text" value="{{hello}}">
</template>
</body>
</html>
Go further
Don't hesitate to checkout the documentation to go further.
Also, check out samples under samples directory.
Different samples there have different dependencies, so make sure running
bower install
there.