Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

v5 Migration #3679

wants to merge 1 commit into from

Conversation

paulfalgout
Copy link
Member

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

return onceCallback;
}

// a custom event channel. You may bind a callback to an event with `on` or
Copy link
Member Author

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) {
Copy link
Member Author

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) {
Copy link
Member Author

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
Copy link
Member Author

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() {
Copy link
Member Author

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) {
Copy link
Member Author

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);
Copy link
Member Author

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);
Copy link
Member Author

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant