Skip to content
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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mpminardi
Copy link

Work in progress changes to README.md to address #10

```

```JavaScript
// app/torii-adapters/application.js
export default Ember.Object.extend({
open: function(authentication){
export default class ApplicationAdapter extends EmberObject {
Copy link
Author

@mpminardi mpminardi Nov 28, 2022

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.

Copy link
Author

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){
Copy link
Author

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.

Copy link
Author

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.

@halfbyte halfbyte changed the base branch from master to main July 18, 2023 13:28
@Gaurav0 Gaurav0 mentioned this pull request Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant