dimanche 16 avril 2017

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

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?




Aucun commentaire:

Enregistrer un commentaire