m.module -> m.mount: fix sample code in HTML files

This commit is contained in:
Matheus Kautzmann 2015-08-28 09:07:08 -03:00
parent dfa1da0652
commit 343ffc8d36
3 changed files with 11 additions and 11 deletions

View file

@ -7,7 +7,7 @@
//drag and drop micro-library //drag and drop micro-library
function dragdrop(element, options) { function dragdrop(element, options) {
options = options || {} options = options || {}
element.addEventListener("dragover", activate) element.addEventListener("dragover", activate)
element.addEventListener("dragleave", deactivate) element.addEventListener("dragleave", deactivate)
element.addEventListener("dragend", deactivate) element.addEventListener("dragend", deactivate)
@ -35,7 +35,7 @@ Uploader.upload = function(files) {
for (var i = 0; i < files.length; i++) { for (var i = 0; i < files.length; i++) {
formData.append("file" + i, files[i]) formData.append("file" + i, files[i])
} }
return m.request({ return m.request({
method: "POST", method: "POST",
url: "http://localhost/api/files", url: "http://localhost/api/files",
@ -85,10 +85,10 @@ demo.view = function(ctrl) {
] ]
} }
m.module(document.body, demo) m.mount(document.body, demo)
//submodule helper //submodule helper
function submodule(module, args) { function submodule(module, args) {
return module.view.bind(this, new module.controller(args)) return module.view.bind(this, new module.controller(args))
} }
</script> </script>

View file

@ -66,5 +66,5 @@ todo.view = function() {
}; };
//initialize the application //initialize the application
m.module(document, {controller: todo.controller, view: todo.view}); m.mount(document, {controller: todo.controller, view: todo.view});
</script> </script>

View file

@ -62,14 +62,14 @@ var ContactForm = {
}, },
view: function(ctrl) { view: function(ctrl) {
var contact = ctrl.contact() var contact = ctrl.contact()
return m("form", [ return m("form", [
m("label", "Name"), m("label", "Name"),
m("input", {oninput: m.withAttr("value", contact.name), value: contact.name()}), m("input", {oninput: m.withAttr("value", contact.name), value: contact.name()}),
m("label", "Email"), m("label", "Email"),
m("input", {oninput: m.withAttr("value", contact.email), value: contact.email()}), m("input", {oninput: m.withAttr("value", contact.email), value: contact.email()}),
m("button[type=button]", {onclick: ctrl.createContact}, "Create") m("button[type=button]", {onclick: ctrl.createContact}, "Create")
]) ])
} }
@ -92,5 +92,5 @@ var ContactList = {
} }
} }
m.module(document.body, ContactsWidget) m.mount(document.body, ContactsWidget)
</script> </script>