-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Readme fixes for Octane / ES6 syntax #12
base: main
Are you sure you want to change the base?
Conversation
``` | ||
|
||
```JavaScript | ||
// app/torii-adapters/application.js | ||
export default Ember.Object.extend({ | ||
open: function(authentication){ | ||
export default class ApplicationAdapter extends EmberObject { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adapters and providers don't technically need to extend EmberObject
but this is a shortcut to allow them to be injected via ember's dependency injection. This would be the most similar to the old way of doing a Ember.Object.extend
.
Discussion in the ember discord here around registering / injecting classes properly linked to this example which would allow for correct registration / injection without extending EmberObject
but would require the following to be defined in user adapter / provider classes:
static create(injections) {
return new this(injections);
}
constructor(injections) {
Object.assign(this, injections);
}
It seems like the documentation for dependency injection is a bit out of date and does not mention using ES6 classes at all so not sure what the preferred path is between these options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively I guess this complexity could be dealt with in base provider / adapter classes in torii itself that users can be guided to extend from when making their own provider / adapter classes.
signInToComment() { | ||
var controller = this.controllerFor('post'); | ||
// The provider name is passed to `open` | ||
this.torii.open('facebook-connect').then(function(authorization){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we also want to change examples using promises to use async
/ await
syntax or if these should be left as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion starting from here in the ember discord is leading me to think that leaving these as-is is the move.
Work in progress changes to
README.md
to address #10