PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/bower_components/backbone.marionette/upgradeGuide.md

https://github.com/robertd/benm
Markdown | 190 lines | 139 code | 51 blank | 0 comment | 0 complexity | 37681f3f72251d9bbb6a998862cdc439 MD5 | raw file
  1. ## Upgrade to v.1.1.0 ~ v1.3.0
  2. No breaking changes have been introduced between these versions
  3. ## Upgrade to v1.1.0
  4. v1.1.0 adds a few new features, but should not break any existing API or
  5. behavior. It should, therefore, be a drop-in replacement for v1.0.x.
  6. Please see the [changelog](https://github.com/marionettejs/backbone.marionette/blob/master/changelog.md)
  7. for the complete list of what was added and fixed in this release.
  8. ## Upgrade to v1.0.0
  9. In addition to the following notes, please see previous upgrade guide entries and the
  10. [changelog](https://github.com/marionettejs/backbone.marionette/blob/master/changelog.md).
  11. ### Backbone 1.0 and Underscore 1.4.4
  12. Marionette v1.0 is built and tested with Backbone v1.0 and Underscore v1.4.4. You should be
  13. able to use Backbone v0.9.9 or v0.9.10 with Marionette 1.0, but there is no
  14. guarantee that everything will work as expected. Older versions of
  15. Backbone are not supported at all.
  16. As of Backbone v1.0, calling `fetch()` on a collection will not trigger the **reset** event
  17. by default. This will cause Marionette's [CollectionView](https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.collectionview.md) and [CompositeView](https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.compositeview.md) to not function
  18. as expected. Be sure to pass the `reset: true` option when calling `fetch()`.
  19. ### Wreqr v0.2.0
  20. This update renames the `addHandler` methods to `setHandler` to help
  21. set the expectation that there is a single handler for any given
  22. command or request/response handler. When updating to Wreqr v0.2.0,
  23. you will need to change all calls to `addHandler` to `setHandler`. For
  24. more information on other changes in Wreqr, see the
  25. [Wreqr changelog](https://github.com/marionettejs/backbone.wreqr/blob/master/CHANGELOG.md).
  26. ### Grunt v0.4
  27. Grunt v0.4 has a significantly different architecture than previous versions. If
  28. you are building Marionette and/or running the specs from your local computer, you
  29. will need to update to the latest version of Grunt v0.4 to do so.
  30. See the
  31. [getting started guide for Grunt](http://gruntjs.com/getting-started).
  32. Once you have done that, you should be able to run Grunt to get things rolling.
  33. ### Marionette.createObject
  34. This method has been removed. It was never used by Marionette directly,
  35. and you should replace its use with a proper polyfill such as Modernizr.
  36. ## Upgrade to v1.0.0-rc4
  37. RC4 is mostly bug fixes and zombie killing. There are a few
  38. things that you need to pay attention to, though. Check the
  39. [changelog](https://github.com/marionettejs/backbone.marionette/blob/master/changelog.md)
  40. for a more complete list.
  41. ### Marionette.addEventBinder Function Has Been Removed
  42. The method `Marionette.addEventBinder` has been removed
  43. entirely. If you were using this method call in your code,
  44. you will need to delete that line of code.
  45. The replacement for this is simply Backbone.Events, which
  46. has the necessary `.listenTo` and `.stopListening` methods,
  47. as noted in previous upgrade guide entries.
  48. The `addEventBinder` had provided a 4th `context` parameter
  49. to the `.listenTo` and `.stopListening` methods, in anticipation
  50. of Backbone adding these in a future release. After further
  51. discussion and research, though, I realized that this parameter
  52. is not needed. Further, Backbone is not going to be adding this
  53. parameter any time soon. There has not been a clear need for
  54. it.
  55. ### Marionette.EventAggregator Object Has Been Removed
  56. The `Marionette.EventAggregator` object did nothing more than
  57. import `Backbone.Wreqr.EventAggregator` in to the Marionette
  58. namespace. This has been removed as it added no value. Replace
  59. all uses of `Marionette.EventAggregator` with
  60. `Backbone.Wreqr.EventAggregator`.
  61. ## Upgrade v1.0.0-rc3 to Backbone v0.9.10 and jQuery v1.9.0
  62. This is a simple update:
  63. * Update Backbone to v0.9.10
  64. * Update jQuery to v1.9.0
  65. Note that there are no changes in Marionette for this minor.
  66. You should not have to change any Marionette specific code
  67. to update your app. You may have to change code that core
  68. Backbone runs, or that jQuery runs, though. This includes
  69. any core Backbone features that are included in Marionette,
  70. such as the use of the `view.make` function which is no
  71. longer included in Backbone.View.
  72. For more information on what you may need to change, see
  73. the change logs for
  74. [Backbone v0.9.10](http://backbonejs.org/#changelog)
  75. and the upgrade guide for [jQuery v1.9.0](http://jquery.com/upgrade-guide/1.9/)
  76. ## Upgrade from v1.0.0-rc2 to v1.0.0-rc3
  77. There are several breaking changes that occurred between v1.0.0-rc2 and
  78. v1.0.0-rc3 that need special attention. Please use this upgrade guide
  79. as a list of things that you need to account for when updating.
  80. In general, you need to grab the latest version of Backbone, Underscore,
  81. and Backbone.Wreqr.
  82. ### Backbone v0.9.2 no longer supported
  83. First and foremost, with the release of Backbone v0.9.9, we are no
  84. longer supporting Backbone v0.9.2. There are several additions to
  85. v0.9.9 that have made code previously found in Marionette's pre-requisites
  86. obsolete. This has caused a ripple effect of API changes for
  87. naming consistency in Marionette.
  88. In order to use Marionette v1.0.0-rc3, you must upgrade to Backbone
  89. v0.9.9 and Underscore v1.4.3 or higher (as necessary, with Backbone
  90. versions).
  91. ### Backbone.EventBinder is now obsolete
  92. With Backbone v0.9.9, the Backbone.EventBinder pre-requisite is now
  93. osbsolete. It will be kept around for backward compatibility with
  94. older versions of Marionette and Backbone, but it is no longer used
  95. by Marionette directly. Unless you have a significant investment in
  96. its use, you should discontinue its use when ugprading to Marionette
  97. v1.0.0-rc3.
  98. To replace the use of Backbone.EventBinder in your Marionette applications,
  99. you have two choices:
  100. 1. Mix Backbone.Events in to your objects directly
  101. 2. Use Backbone.Wreqr.EventAggregator
  102. With the introduction of `.listenTo` and `.stopListening` to Backbone.Events,
  103. the need for Backbone.EventBinder is no longer there. You can either
  104. use `_.extend(myObject, Backbone.Events)` to mix in Backbone.Events
  105. directly, or you can use an instance of `Backbone.Wreqr.EventAggregator`
  106. to replace your Backbone.EventBinder instances, directly.
  107. Along with this dependency being obsolete now, you should make the
  108. following changes:
  109. * Replace `bindTo` with `listenTo`
  110. * Replace `unbindAll` with `stopListening`
  111. * Remove calls to `unbindFrom` as this has no equivalent
  112. ### Marionette.Async is no longer supported
  113. The Marionette.Async library was a mistake from the start. It advocated
  114. bad practices by making the View layer responsible for the knowledge
  115. of application workflow. I'm happy to say that it has been removed
  116. from Marionette and is no longer supported.
  117. If your app currently relies on Marionette.Async, I suggest re-thinking
  118. the architecture before upgrading to Marionette v1.0.0-rc3 or later. Specifically,
  119. move any logic that deals with asynchronous calls, and workflow / process
  120. logic out of your views and in to a Marionette.Controller or other object
  121. that can properly coordinate the efforts.
  122. For example, loading a model before displaying it:
  123. ```js
  124. Marionette.Controller.extend({
  125. showById: function(id){
  126. var model = new MyModel({
  127. id: id
  128. });
  129. var promise = model.fetch();
  130. $.when(promise).then(_.bind(this.showIt, this));
  131. },
  132. showIt: function(model){
  133. var view = new MyView({
  134. model: model
  135. });
  136. MyApp.myRegion.show(view);
  137. }
  138. });
  139. ```