Me
Alive
• Mozilla Corp. Taiwan, Frontend engineer
• ~1.5 year experience on web
• https://github.com/alivedise
• email: alegnadise@gmail.com
alive@mozilla.com
http://javascriptmvc.com
• PROS
o MIT license
o Clear documentation
o Nearly total solution to build a web
application
• CONS
o Less known, less resource (in Taiwan)
o No preset UI layer implementation
$.Model
• CRUD functions, overwrittable
• Event callback whenever data is
o created
o deleted
o updated
o and if you like, custom event on model is
creatable.
• DOM embeddable
o <div <%= model %></div>
• Validation in data model layer
When you have more and more jQuery plugins..
• None loosely coupled.
• No cross function communication.
• DOM renew and event rebind
oa long long string in your javascript like
$('#div').html('<div class="event"><span
class="name"></span><span class="icon"></span><span
class="content"></span><span class="screenshot"></
span></div>');
$.Controller - Event delegation function
$.Controller("Crazy",{
// listens to all clicks on this element
"click" : function(el, ev){},
// listens to all mouseovers on
// li elements withing this controller
"li mouseover" : function(el, ev){}
// listens to the window being resized
"{window} resize" : function(window, ev){}
});
•You can do nothing without server.
Do you?
• Multi ajax request solution
Deferred model
•Since jQuery 1.5, ajax is implemented as a
deferred object.
•Models CRUD support deferred operation.
$.fixture
o Create a deferred instead of sending
XMLHttpRequest to the server, but to the
function you preferred.