Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Add namespace and make events past tense #1384

Merged

Conversation

interactivellama
Copy link
Contributor

This change still needs to be discussed. Fixes #1383.

This is only a breaking change if developers have used $().on('accept') as 'documented' in the source and not $().on('accept.fu.placard') and $().on('cancel.fu.placard') as the documentation recommends.

Also, these appear to be events that did not get switched to past tense.

UPDATED: This is a breaking change for event names of placard.

@swilliamset
Copy link
Contributor

fix with past tense.

@interactivellama
Copy link
Contributor Author

We can support and fire both since adding an 'ed' will not fire the event twice like just adding a namespace does.

@interactivellama interactivellama force-pushed the placard-event-namespace branch from 5bca4d0 to dfe13c2 Compare July 6, 2015 20:32
@interactivellama
Copy link
Contributor Author

Updated PR with DEFINITELY breaking changes. The callbacks, onAccept and onCancel, remain intact.

Events are now accepted.fu.placard and cancelled.fu.placard

@@ -440,6 +440,13 @@ define(function (require) {
});
});

$('#myPlacard3').on('accept.fu.placard', function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these need to be accepted.fu.placard and cancelled.fu.placard later on down

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Thanks!

@interactivellama interactivellama force-pushed the placard-event-namespace branch from dfe13c2 to 00c0dde Compare July 7, 2015 15:52
@interactivellama interactivellama changed the title Add namespace to placard events Add namespace and make events past tense Jul 7, 2015
@@ -63,30 +63,31 @@
constructor: Placard,

complete: function (action) {
var func = this.options['on' + action[0].toUpperCase() + action.substring(1)];
var eventName = action === 'accepted' ? 'accept' : 'cancel';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var EVENT_MAP = { 'accepted': 'onAccept', 'cancelled': 'onCancel' }; // move up in scope outside function
var func = this.option[EVENT_MAP[action]];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. It allows 'maybe':'imThinkingAboutIt' to be added in the future. j/k

@swilliamset
Copy link
Contributor

Make the suggested adjustment above otherwise the logic for determining a function name is overly complicated.

@swilliamset
Copy link
Contributor

pushed back to make constants mapper a private variable

@interactivellama interactivellama removed their assignment Jul 9, 2015
@interactivellama
Copy link
Contributor Author

Updated.

swilliamset pushed a commit that referenced this pull request Jul 9, 2015
Add namespace and make events past tense
@swilliamset swilliamset merged commit 0a7857c into ExactTarget:master Jul 9, 2015
@interactivellama interactivellama deleted the placard-event-namespace branch April 4, 2016 15:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants