Releases: marionettejs/backbone.marionette
Releases · marionettejs/backbone.marionette
v2.2.0-pre
v2.1.0
- Features
- Marionette.Object
- A base class which other classes can extend from. Marionette.Object incorporates many backbone conventions and utilities like
initialize
andBackbone.Events
. It is a user friendly class to base your classes on to get Backbone conventions on any generic class.
- A base class which other classes can extend from. Marionette.Object incorporates many backbone conventions and utilities like
- Add a
el
reference to the viewsel
from within abehavior
instance. ItemView
s can now have no template by settingtemplate: false
- Application objects can now configure their default message channel.
- This will allow you to configure multiple applications to exist at the same time within an apps without their event bus colliding.
- Application objects now have the
getOption
method. - Regions now have a
hasView
method to determine if there is a view within a given region. - Views no longer use toJSON directly on models. instead they call into the new overridable methods
serializeModel
andserializeCollection
where are called viaserializeData
- Return chainable objects from more methods to be consistent
- Application: emptyRegions
- Application: removeRegion
- CollectionView renderChildView
- Controller new
- LayoutView destroy
- Region reset
- Region attachView
- Region empty
- RegionManager destroy
- RegionMananger emptyRegions (now returns regions)
- RegionMananger removeRegions (now returns regions)
- RegionMananger removeRegion (now returns region)
- View destroy
- View undelegateEvents
- View delegateEvents
- RegionManager
addRegions
now accepts a function that returns a region definition in addition to a region definition object- This extends to Marionette.Application’s and CompositeView’s
regions
properties
- This extends to Marionette.Application’s and CompositeView’s
- Added CollectionView
resortView
- Override this method on a subclass of CollectionView to provide custom logic for rendering after sorting the collection.
- View instance is now passed as a third argument to
Marionette.Renderer.render
- Add
getRegionMananger
to Application
- Marionette.Object
- Fixes
- CollectionView now maintains proper order when adding a mode
- Fix component.js path
- Prevent AppRouter from erroring when appRoutes are passed into the router constructor as an option.
- UI hash keys now only allow documented syntax, enforcing
@ui.stuff
instead of@ui<ANY_CHAR>stuff
v2.1.0-pre
v2.1.0-pre
v2.0.3
v2.0.2
v2.0.1 Release
- Fix missing Wreqr and Babysitter in Core AMD definition. via #1501
v2.0.0
If you are looking to upgrade a 1.x app please use https://github.com/marionettejs/Marionette.Upgrade
Questions? Need help? Join us on gitter.im
https://gitter.im/marionettejs/backbone.marionette
The Changes:
General
- API change: Removed the
Marionette.$
proxy. We are now usingBackbone.$
instead. - API change: All instances of the word
type
in the API have been replaced with the wordclass
. For instance:- regionType => regionClass
- ChildViewType => ChildViewClass
- triggerMethod now calls the method before triggering the event. Previously it was the other way around.
- jQuery deferred objects can now be replaced via the global
Marionette.Deferred
object. - Stricter JSHint rules were implemented for more consistent style across the codebase.
- A new property,
Marionette.VERSION
, was added. - Most classes now have
getOption
attached to their instances, taking advantage of the new helper functionMarionette.proxyGetOption
- Most classes now have
bindEntityEvents
attached to their instances, taking advantage of the new helper functionMarionette.proxyBindEntityEvents
- Most classes now have
unbindEntityEvents
attached to their instances, taking advantage of the new helper functionMarionette.proxyUnbindEntityEvents
- There are now only two built versions of Marionette, and both come in UMD wrappers. The first is the core by itself and the second is the bundled version (with Wreqr and Babysitter).
Applications and Modules
- API change: The arguments of a Module’s initialize function are now consistent with Module constructor argument order. Previously they were inconsistent with one another.
initialize: function( moduleName, app, options ) {
- API change: Application’s
initialize
triggerMethods have been renamed tostart
, which is more descriptive of what is actually happening. More specifically,initialize:before
andinitialize:after
are nowbefore:start
andstart
, respectively. Note that no functionality has been lost with this change; it is merely a changing of names. - The Application message system has been replaced with a channel named “global”
- Applications have two new triggerMethods:
before:region:add
andbefore:region:remove
to complement their existing region events.
Controllers
- API change:
stopListening
is now called after thedestroy
triggerMethod is called. - API change:
close
has been renamed todestroy
to emphasize the fact that an instance should not be reused, or ‘opened,’ after it is destroyed. - The
before:destroy
triggerMethod has been added to controllers. Due to this your controllers can now implement aonBeforeDestroy
method to be invoked just before a Controller has been destroyed.
Behaviors
Behaviors
now support a means to group behaviors together. Any Behavior can now have a behavior key of its own, very similar to how a view can have behaviors.
Regions
- API change: Regions now throw an error when show is called with a nonexistent el. Previously this was a silent failure.
- Region’s
ensureEl
has been renamed to_ensureElement
- API change: Regions now expose region.el and region.$el, just like View’s.
Due to this change if you were depending on region.el to be a string selector you must update your code to use region.$el.selector. - API change: The
open
method has been renamed toattachHtml
. - API change: The close method has been renamed to
empty
, as it functions quite differently from a View’s close method. - Regions now use
.innerHtml
when clearing contents as compared thisthis.$el.empty()
. region.show
now returnthis
, just like how a view’s render returnsthis
.- Regions trigger two new events,
before:swap
andswap
, when it swaps views when callingshow
. - Region’s el can now be a DOM node / DOM string selector / Jquery selector instance, just like a View’s el.
- Calling show on a region with the same view that is currently shown is now a noop. Previously the view would be re-rendered. You can force a rerender by passing
forceShow: true
with the region show options.
MyApp.mainRegion.show(myView, {forceShow: true});
- Regions now fire a new triggerMethod,
before:destroy
, before they are destroyed. - There is a new triggerMethod:
before:empty
RegionManagers
getRegions
: returns all of the regions of a given RegionManager instance as an Array. This method is also exposed to the Layout and Application as getRegions.
Views
- API change:
Layout
is now calledLayoutView
. - API change: Renamed
close
todestroy
for views. Close was a confusing verb for users who thought that they could be reopened. The verb destroy makes it more clear that once a view is destroyed you can not reuse it. - API change: Returning false from
onBeforeClose
no longer prevents the view from closing. This behavior was inconsistent with the rest of the library, and would require far too much logic to respect in all cases. Instead of returning false, you should handle your logic before calling close on the view. - API change:
appendHtml
has been renamed toattachHtml
.appendBuffer
has been renamed toattachBuffer
- API change: Removes duplicate and inconsistent
itemView
events. No functionality was lost with this change; simply use the unprefixed version instead. For instance, usebefore:render
instead ofitem:before:render
.- item:before:render
- item:rendered
- itemview:item:before:render
- itemview:item:rendered
- itemview:item:before:close
- itemview:item:closed
- item:before:destroy
- item:destroyed
- API change: childEvents callbacks no longer receives the event name as the first argument, making the arguments of those callbacks consistent with standard
trigger
callbacks. - API change:
itemView
within acollectionView
is now known aschildView
. This removes confusion for new users as to the fact that you can show any type of view in yourcollectionView
. All CollectionView methods that referenceditemView
now use the samechildView
as well. For instance,getItemView
is nowgetChildView
. Do note that CompositeViews extend from CollectionView, so these API changes affect that Class as well. - API change:
collectionView
, andcompositeView
, have new listener callbacks for their underlying collection.addChildView
is now_onCollectionAdd
andremoveItemView
is now_onCollectionRemove
- API change:
renderModel
forcompositeView
is now called_renderRoot
. - API change: collectionView’s and compositeView’s method
onChildRemove
is now known as_onCollectionRemove
- Bug fix: UI interpolation for events no longer mutates the prototypes event hash
- Bug fix: UI interpolation for events now works properly if you dynamically add @ui interpolated events to a view instance and call
delegateEvents
on the view instance. - A views html content insertion can now be overridden on a per view basis via
attachElContent
to render in a non standard way for optimization and not standard use cases. This is available to all views with templates: Item View, Layout View, and Composite View.
For example, using innerHTML
instead of $el.html
attachElContent: function(html) {
this.el.innerHTML = html;
return this;
}
- A new triggerMethod was added to collectionView:
before:remove:child
. - Collection and Composite Views now respect the collection comparator when rendering and when new views are added. This means that your collection will stay in order on the DOM.
collectionView
andcompositeView
now have an optional emptyViewOptions property which allows you to customize youremptyView
.addItemView
is nowaddChild
: This will not be a one to one conversion and will require you to update your implementation if you are not callingsuper
- Layouts now facilitate overriding the default RegionManager with a custom Class through the use of the
getRegionManager
method. - LayoutViews now lets you specify the
regions
hash as an option upon instantiation. Previously you need to create a brand new LayoutView class to set the regions.
new Marionette.LayoutView({
regions: {
"cat": ".doge",
"wow": {
selector: ".such",
regionClass: Coin
}
}
})
- LayoutViews have a new property:
regionOptions
. These are the options that are passed into each region upon creation.
Cleanup
- Removes calls to
MyClass.prototype.constructor
, instead simply referencing MyClass. - Swapped Jasmine for Mocha for unit tests
- All code is now instrumented via coveralls for every PR. This gives a code coverage statistic for us to identify testing gaps.
For a closer look at each change, refer to the https://github.com/Puppets/marionette-changelog-detail.
v1.8.8 nested behavior onShow fix
- Fixes
- Fixed the case where onShow was not called on child view behaviors when inside a Collection or Composite view.
@UI fix
v2.0.0-pre.2 - fast forward
The changelog is quite large, please refer to the google doc for a summary
https://docs.google.com/document/d/1fuXb9N5LwmdPn-teMwAo3c8JTx6ifUowbqFY1NNSdp8/edit#
Please reach out with questions and or feedback here
https://gitter.im/marionettejs/backbone.marionette