aomran / ember-cli-zero-clipboard

Ember CLI addon for adding a "copy to clipboard" button component
https://www.npmjs.org/package/ember-cli-zero-clipboard
17 stars 12 forks source link

usage with promise #24

Closed masciugo closed 9 years ago

masciugo commented 9 years ago

I am trying to customize like this:

actions: {
  copy: function (argument) {
    return this.get('ledger').share().then((response) => {
      return response;
    }, function (error) {
      console.error(error);
    });
  },
  afterCopy: function(){
    log.debug('afterCopy!!!');
  }
}

afterCopy is called before the promise in copy is fulfilled. This is probably the expected behaviour but is it possible to have this working some other way? Alternatively how can I tell a promise to wait for fulfilment?

masciugo commented 9 years ago

https://github.com/zeroclipboard/zeroclipboard/blob/master/docs/instructions.md#synchronicity-required-during-copy