- Chaplin
Upgrading guide
Upgrading to 1.0 (0.13)
- Replace
this.compose
in Controllers withthis.reuse
.
Upgrading to 0.12
- Replace all references to
Chaplin.helpers
withChaplin.utils
. - If you are using Delayer, make sure to include separate Delayer package — it has been removed from Chaplin core.
- If you are using Exoskeleton, make sure to upgrade to v0.6.
Upgrading to 0.11
- Change controller action param order: from (
params, route, options
), query string URL will no longer reside inparams
./users/paulmillr?popup=1
(assuming/users/:name
route) will pass:- Before:
params={name: 'paulmillr', popup: '1'}
- Now:
params={name: 'paulmillr'}, options={query=popup: '1'}
- Before:
- Rename
Application#startRouting
toApplication#start
(the following method also does freezing of app object). - Since
!event
pattern was replaced with Request / Response, stop publishing various global events:- Instead of
!router:route
and!router:routeByName
, useChaplin.helpers.redirectTo
. - Instead of
!router:changeURL
event, execute mediator handler:mediator.execute('router:changeURL', args...)
- Instead of
!adjustTitle
event, execute mediator handler:mediator.execute('adjustTitle', name)
- Instead of
!composer:compose
/!composer:retrieve
events, usemediator.execute('composer:compose')
/mediator.execute('composer:retrieve')
- Instead of
!region:register
/!region:unregister
events, usemediator.execute('region:register')
/mediator.execute('region:unregister')
- Instead of
- Replace
Controller#redirectToRoute(name)
withController#redirectTo(name)
- Replace
Controller#redirectTo(url)
withController#redirectTo({url: url})
. - Keep in mind that
Controller#compose
now:- by default, returns the composition itself
- if composition body returned a promise, it returns a promise too
Upgrading to 0.10
- Replace
application = new Chaplin.Application(); application.initialize()
withnew Chaplin.Application
:initialize
is now called by default. Application#initialize
now has default functionality, make sure to adjustsuper
calls.- Swap view regions syntax to more logical:
- Before:
regions: {'.selector': 'region'}
. - Now:
regions: {'region': '.selector'}
.
- Before:
- Make sure to remove
callback
argument from!router:route
and!router:routeByName
event calls — it is synchronous now.
Upgrading to 0.9
Controller#beforeAction
must now be a function instead of an object.- Remove
initDeferred
method calls from Models and Collections (or provide your own). - Make sure to adjust your routes:
deleted_users#show
won’t longer be rewritten todeletedUsers#show
- Rename methods in your
Layout
subclass (if you're subclassing it):_registeredRegions
toglobalRegions
registerRegion
toregisterGlobalRegion
registerRegion
toregisterGlobalRegions
unregisterRegion
tounregisterGlobalRegion
unregisterRegions
tounregisterGlobalRegions
- Provide your own
utils.underscorize
.
Upgrading to 0.8
*Application#initRouter
.
Application#startRouting
* Adjust your controller actions params to
params, route, options
instead of params, options
.
* Remove RegExp routes. Use constraints
route param and strings instead.
* Rename matchRoute
global event to router:match
* Rename startupController
global event to dispatcher:dispatch
* If you are subclassing Dispatcher
, many methods now
receive route
too.
Upgrading to 0.7
- Change your controller action params: instea dof
params, previousControllerName
, useparams, options={previousControllerName, path...}
- Change
View
:- Rename
View#afterRender
toView#attach
. - Remove
View#afterInitialize
. - Remove
View#pass
.
- Rename
- Change
CollectionView
:- Rename
CollectionView#itemsResetted
toCollectionView#itemsReset
. - Rename
CollectionView#getView
toCollectionView#initItemView
. - Rename
CollectionView#showHideFallback
toCollectionView#toggleFallback
. - Rename
CollectionView#showHideLoadingIndicator
toCollectionView#toggleLoadingIndicator
. - Remove
CollectionView#renderAndInsertItem
. - Item views will now emit
addedToParent
event instead ofaddedToDOM
when they are appended to collection view.
- Rename
- Don't use
utils.wrapMethod
(or provide your own).