Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

Ember 2, call functions in route using Ember.run.debounce

$
0
0

@johnunclesam wrote:

I'm in a route called "game".

In an action I call Ember.run.debounce for a function, but in that function I can't call other functions.

app/routes/game.js:

import Ember from 'ember';
export default Ember.Route.extend({

  model() {
    ...
  },

  saveGame: function () {
    this.save().then(() => {
      this.updateOtherGames(); //<------ ERROR ERROR ERROR ERROR
    })
  },

  updateOtherGames(game) {

  },

  actions: {
    playGame(game) {
      ...
      Ember.run.debounce(game, this.saveGame, 5000);
    }
  }
})

Why I can't call updateOtherGames?

Why this in the saveGame function is only referring to game nd not the route?

Posts: 6

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles