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.List
is 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.find
is gone, usethis.element.find
in controlsattrs
is now justattr
- jQuery plugins are not automatically hooked up, you have to include
can/control/plugin
.super
and.proxy
are no longer included by default<%== view('myejs', {}) %>
is no longer there, just use<%== can.view.render() %>
- You should no longer use
this
in EJS when referring to thethis
context, 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.Class
is nowthis.constructor
- In EJS
<%== plugin('fun_menu', {}) %>
would now be<%== (el)->el.fun_menu() %>
this.callback
is nowthis.proxy
.model()
and.models()
for dom hookup is now.instance()
and.instances()
this.view
incan/control/view
returns a document fragment not a DOM node.- Models must return deferreds
steal.options
is moved tosteal.config()
steal.root
is moved tosteal.config().root
- If you override the
success
property of ajax calls in models, you models will NOT be piped through to be wrapped and added to lists. Model.List.get
has changed from accepting the whole object to just the id. Example:Model.List.get(id)
this.bind
in control is nowthis.on
List.each
used to beindex, itemItterating
, now its opposite.
These are still present but should be removed soon.
- Remove
.then()
from steal listensTo
is 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.
$.Class
is nowcan.Construct
$.Controller
is nowcan.Control
$.route
is nowcan.route
$.Model
is nowcan.Model
MXUI
is now called canui
. You can remap this easily in the stealconfig.js
file.
steal.config({
map: {
"*": {
"mxui/": "canui/"
}
}
});