-
Chaplin

Upgrading guide
Upgrading to 1.0 (0.13)
- Replace
this.composein Controllers withthis.reuse.
Upgrading to 0.12
- Replace all references to
Chaplin.helperswithChaplin.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/:nameroute) will pass:- Before:
params={name: 'paulmillr', popup: '1'} - Now:
params={name: 'paulmillr'}, options={query=popup: '1'}
- Before:
- Rename
Application#startRoutingtoApplication#start(the following method also does freezing of app object). - Since
!eventpattern was replaced with Request / Response, stop publishing various global events:- Instead of
!router:routeand!router:routeByName, useChaplin.helpers.redirectTo. - Instead of
!router:changeURLevent, execute mediator handler:mediator.execute('router:changeURL', args...) - Instead of
!adjustTitleevent, execute mediator handler:mediator.execute('adjustTitle', name) - Instead of
!composer:compose/!composer:retrieveevents, usemediator.execute('composer:compose')/mediator.execute('composer:retrieve') - Instead of
!region:register/!region:unregisterevents, 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#composenow:- 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:initializeis now called by default. Application#initializenow has default functionality, make sure to adjustsupercalls.- Swap view regions syntax to more logical:
- Before:
regions: {'.selector': 'region'}. - Now:
regions: {'region': '.selector'}.
- Before:
- Make sure to remove
callbackargument from!router:routeand!router:routeByNameevent calls — it is synchronous now.
Upgrading to 0.9
Controller#beforeActionmust now be a function instead of an object.- Remove
initDeferredmethod calls from Models and Collections (or provide your own). - Make sure to adjust your routes:
deleted_users#showwon’t longer be rewritten todeletedUsers#show - Rename methods in your
Layoutsubclass (if you're subclassing it):_registeredRegionstoglobalRegionsregisterRegiontoregisterGlobalRegionregisterRegiontoregisterGlobalRegionsunregisterRegiontounregisterGlobalRegionunregisterRegionstounregisterGlobalRegions
- 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#afterRendertoView#attach. - Remove
View#afterInitialize. - Remove
View#pass.
- Rename
- Change
CollectionView:- Rename
CollectionView#itemsResettedtoCollectionView#itemsReset. - Rename
CollectionView#getViewtoCollectionView#initItemView. - Rename
CollectionView#showHideFallbacktoCollectionView#toggleFallback. - Rename
CollectionView#showHideLoadingIndicatortoCollectionView#toggleLoadingIndicator. - Remove
CollectionView#renderAndInsertItem. - Item views will now emit
addedToParentevent instead ofaddedToDOMwhen they are appended to collection view.
- Rename
- Don't use
utils.wrapMethod(or provide your own).