-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v5 Migration #3679
base: master
Are you sure you want to change the base?
v5 Migration #3679
Conversation
return onceCallback; | ||
} | ||
|
||
// a custom event channel. You may bind a callback to an event with `on` or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below is a refactored version of Backbone's Events
@@ -17,7 +17,31 @@ var proxy = function proxy(method) { | |||
|
|||
// Marionette.extend | |||
|
|||
var extend = Backbone.Model.extend; | |||
function extend (protoProps, staticProps) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from Backbone
|
||
// Event Delegator | ||
|
||
function setEventDelegator(mixin) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event delegator handles DOM event delegation and was copied from Backbone.View
return this; | ||
} | ||
var DomApi = { | ||
// Returns a new HTML DOM node of tagName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOM Api was updated to remove jquery by default as $el
is no longer cached on the view
Dom: DomApi, | ||
// Create an element from the `id`, `className` and `tagName` properties. | ||
_getEl: function _getEl() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copied/modified from Backbone.View
|
||
_.extend(ViewMixin, BehaviorsMixin, CommonMixin, DelegateEntityEventsMixin, TemplateRenderMixin, TriggersMixin, UIMixin); | ||
|
||
function isView(view) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New way of determining what a view is. Rather than depending on prototypal inheritance, anything that supports the API used by Marionette will be attempted.
if (this.$el.length > 1) { | ||
this.$el = this.Dom.getEl(this.el); | ||
} | ||
this.el = this.getEl(el); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$el is no longer cached on Regions
|
||
this._initBehaviors(); | ||
this.preinitialize.apply(this, arguments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bb's preinitialize added to views
ae073ed
to
d2e56be
Compare
DO NOT MERGE This PR serves as a migration guide for moving to https://github.com/marionettejs/marionette with the exception of Radio integration. But it should make relevent breaking changes more obvious
d2e56be
to
e782b4a
Compare
DO NOT MERGE
This PR serves as a migration guide for moving to https://github.com/marionettejs/marionette with the exception of Radio integration.
But it should make relevent breaking changes more obvious