7. can.Control(proto)
var Tabs = can.Control({
init: function( el ) {
// show first tab
},
'li click': function( el, ev ) {
// hide other tabs
// show selected tab
}
});
new Tabs('#tabs');
8. can.route(route, defaults)
var Routing = can.Control({
':type/:id route': function( data ) {
}
})
new Routing( document.body );
can.route.attr( { type : 'todos', id: 5 } )
10. EmbeddedJS Templates
Favorite tag is <%= ‟<blink>Blink</blink>‟ %>
-> My favorite tag is <blink>Blink</blink>
Favorite tag is <%== ‟<blink>Blink</blink>‟ %>
-> Favorite tag is Blink
Hello, I'm Justin Meyer from BitoviI'm very proud that this is the second time Bitovi (formerly Jupiter) has sponsered JSConfThis year it comes at an important time for us. Not only are we announcing the rebranding at this conference (we are Bitovi now), we are releasing thenext version of JavaScriptMVC's MVC parts called CanJS.In this talk, I'll introduce what's inside CanJS and talk about why, despite a lot of great existing MVC libraries, we think CanJS is the best one the market.
It will fix the memory leaks that you probably don’t even know you have.Fastest control initialization and live template binding. Your app will start fast and run fast.And it’s super easy to pick up, we documented the hello out of it.
positivity
A basic constructor function helper. Useful for providing inheritance. All of JMVC’s constructors inherit from it.
A basic constructor function helper. Useful for providing inheritance
A basic constructor function helper. Useful for providing inheritance hooks up observes to your back end with declarative service bindings
A basic constructor function helper. Useful for providing inheritance
A basic constructor function helper. Useful for providing inheritance - A special observe that is cross bound to the route - pretty urls
Impossible to create memory leaksPeople don't know what they are doingCan see it in something as simple as a tool tip where you mouseover the elementand it shows the tooltip widget.You might use this tooltip widget like the following: listen on an anchor element, create the content for the tooltip call tooltipFor with the anchor
can.Control fixes this with templated event handlersYou can bind events that will always be unbound auto-magically
----- Meeting Notes (4/3/12 00:38) -----cleaned up
The next way CanJS helps with memory is through it’s non-leaking global store. Say we have 2 Todo lists, Critical Todos and today’s todos. These lists might get back data for the same instance of a todo. The problem happens when a user changes properties on a todo that exists in both lists. Both lists need to be listening to property changes on the same todo instance.Model needs to see that the data it retrieves belongs to the same instance and return the previously created instance instead of creating a new one.Most MVC libraries either ignore it or solve it with a model store that has all instances, when data is retrieved for an instance, it checks if the instance is already created and uses that instance instead of creating a new one.The problem with this is for long-lived applications, you are constantly collecting unused instances, which fills memory. The developer has to tell the store when to flush instances.CanJS solves this by keeping things in the store only when it knows you are interested in them. How do you express interest? Well by binding to the instance. So, Model keeps instances in the store only while they have event handlers.This, combined with templated event handling, means that simply by replacing the todo list ELEMENTs with a list of “Awesome Developers”<li class=“<%= todo.attr(‘complete’) ? “done” :”” %>” >Very common, but tricky and critical problem for MVC.CanJS has a non-leaking global store, that allows it to solve the 2 ‘instance’ problem without permanently storing all model instances.
All controls are torn down, when all controls are torn down, all event handlers are unbound. When an model instances event handlers are unbound, it’s removed from the store.If you don’t understand this, that’s ok … the big take away is that it’s pretty much impossible to make a leaking CanJS app … You bind and forget ….
Set out to make CanJS the best documented library.Awesome overview page with it’s sweet navigation, underlying docs for every function, method, attribute, and demo applications for each component.Annotated SourceAnd hire us for training, support, or development
deep bindingthe flexibility to switch between libraries without losing all your skills and even some of your (code)
Hello, I'm Justin Meyer from BitoviI'm very proud that this is the second time Bitovi (formerly Jupiter) has sponsered JSConfThis year it comes at an important time for us. Not only are we announcing the rebranding at this conference (we are Bitovi now), we are releasing thenext version of JavaScriptMVC's MVC parts called CanJS.In this talk, I'll introduce what's inside CanJS and talk about why, despite a lot of strong competition, we think CanJS is the best MVC library on the market.