amkirwan / ember-oauth2

JavaScript library for using OAuth 2.0 Implicit Grant flow (Client-Side Flow) with Ember.js
MIT License
133 stars 22 forks source link

Use Ember.Evented for redirect, success and error events #6

Closed theodorton closed 10 years ago

theodorton commented 10 years ago

Instead of directly defining the onRedirect, onSuccess and onError callbacks directly on the object, this pull request extends the Ember.OAuth2 object with Ember.Evented so that one can define more callbacks, and be more specific.

Ember.Evented has support for on, one and off, this library can now use this.

It should maintain backward compatibility with the previous syntax, but will log deprecation notices to the console when detected.

amkirwan commented 10 years ago

Looked over the patch and it looks like a good idea to switch over to using the Evented class. Just give me a day or two to think about if there are any changes or additional features to add to the patch before merging.

theodorton commented 10 years ago

Cool :) I started experimenting with returning a promise from .authorize as well, which I quess would be more typical for ember. May be a good fit for this patch.

amkirwan commented 10 years ago

Just a few minor notes in the code to use the strict comparison operators. Once those are set I'll merge the patch then I will update the README with a little more detail about the api changes to the callbacks.

theodorton commented 10 years ago

I took the liberty of cleaning up the jshint grunt tasks (they should've captured the missing strict comparison operators in the first place).

Looks ok?

amkirwan commented 10 years ago

Everything looks good. Thanks for cleaning up the jshint grunt task. I'll merge the changes later tonight. Cheers.