A informal guide to things that have changed over the past versions and how you can get your project up to snuff.
These aren't necessarily new features but things were there in some capacity before but expanded upon in latest.
Model.Listis now available forObserves- You can call methods directly from templated bindings. F example:
"resize":function() { this.updateUI() });could now be just"resize": "updateUI" instances()andinstance()can be called on observes.
These are things that have been completely removed and you will need to either make mappings for or update.
- Remove
$infunction($)from steal function callbacks this.findis gone, usethis.element.findin controlsattrsis now justattr- jQuery plugins are not automatically hooked up, you have to include
can/control/plugin .superand.proxyare no longer included by default<%== view('myejs', {}) %>is no longer there, just use<%== can.view.render() %>- You should no longer use
thisin EJS when referring to thethiscontext, it is implied. - You can no longer init a list with a collection or item like:
var list = new Twitter.Models.Item.List(item)
Things that have been there but the API is slightly different.
this.Classis nowthis.constructor- In EJS
<%== plugin('fun_menu', {}) %>would now be<%== (el)->el.fun_menu() %> this.callbackis nowthis.proxy.model()and.models()for dom hookup is now.instance()and.instances()this.viewincan/control/viewreturns a document fragment not a DOM node.- Models must return deferreds
steal.optionsis moved tosteal.config()steal.rootis moved tosteal.config().root- If you override the
successproperty of ajax calls in models, you models will NOT be piped through to be wrapped and added to lists. Model.List.gethas changed from accepting the whole object to just the id. Example:Model.List.get(id)this.bindin control is nowthis.onList.eachused to beindex, itemItterating, now its opposite.
These are still present but should be removed soon.
- Remove
.then()from steal listensTois gone in controls. Just listen for the events using event delegationcan.Control.extend()the extend part is no longer needed; just docan.Control()
You've probably already done these but just in case.
<%= %>will now escape and<%== %>is unescapedcan.Control({}, {})no longer has to have both if you only want the prototype you can docan.Control({})
These should be obvious but just in case.
$.Classis nowcan.Construct$.Controlleris nowcan.Control$.routeis nowcan.route$.Modelis nowcan.Model
MXUI is now called canui. You can remap this easily in the stealconfig.js file.
steal.config({
map: {
"*": {
"mxui/": "canui/"
}
}
});