Skip to content

Commit

Permalink
spike
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Mar 21, 2018
1 parent 87f43e4 commit eadf51b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/ember-runtime/lib/mixins/action_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ const ActionHandler = Mixin.create({
@public
*/
send(actionName, ...args) {
assert(
`Attempted to call .send() with the action '${actionName} on the destroyed object '${this}'.`,
!this.isDestroying && !this.isDestroyed
);
if (this.actions && this.actions[actionName]) {
let shouldBubble = this.actions[actionName].apply(this, args) === true;
if (!shouldBubble) { return; }
Expand Down
10 changes: 10 additions & 0 deletions packages/ember-views/lib/mixins/action_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ export default Mixin.create({
actionName = get(this, `attrs.${action}`) || get(this, action);
actionName = validateAction(this, actionName);

assert(
`Attempted to call .sendAction() with the action '${actionName} on the destroyed object '${this}'.`,
!this.isDestroying && !this.isDestroyed
);

// If no action name for that action could be found, just abort.
if (actionName === undefined) { return; }

Expand All @@ -132,6 +137,11 @@ export default Mixin.create({
},

send(actionName, ...args) {
assert(
`Attempted to call .send() with the action '${actionName} on the destroyed object '${this}'.`,
!this.isDestroying && !this.isDestroyed
);

let action = this.actions && this.actions[actionName];

if (action) {
Expand Down

0 comments on commit eadf51b

Please sign in to comment.