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

Update to rxjs 6.3.3. Use prettier to format. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

deanrad
Copy link

@deanrad deanrad commented Jan 13, 2019

Manuel - you don't know how much your work here has been an inspiration for at least 2 years now. I finally am doing some stuff with RxJS for real and want to use this as a demo. I'd like your permission, and if you'd give a mention that'd be great.

It's currently deployed here with some of my cosmetics. I'd like to use this as an example in my Rx-wrapper project Antares which aims to make event driven programming easier.

@Lorti
Copy link
Owner

Lorti commented Jan 13, 2019

Thank you for your kind words and the long overdue update to the latest RxJS! 🙇‍♂️

That's a lot of changes, it may take some time until I find the time to review them, but I'm looking forward to it.

Of course you're free to do whatever you want with my open-source code, no need to ask for permission.

Copy link
Owner

@Lorti Lorti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @deanius. Be sure to add yourself as a contributor to both package.json and the README.md after addressing the feedback ;)

withLatestFrom,
take,
sample
} from 'rxjs/operators';

/* Graphics */
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think overall the structure of the file has suffered. Before it had sections marked with comments (/* Graphics */...), now the structure of the file is a bit confusing.

map,
scan,
withLatestFrom,
take,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

take seems to be unused?
And in what order are the imports?

@@ -0,0 +1,4 @@
{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the rc file, but right now it assumes a globally installed prettier and knowledge on how to run it? Could you add prettier as a dependency and add a script to package.json as well?

context.font = '24px Courier New';
context.fillText('rxjs breakout', canvas.width / 2, canvas.height / 2 - 24);
}
const INITIAL_OBJECTS = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grouping the constants together at the start of the file seems a good idea, although I'm personally torn between "group by game components" and "group by language constructs" for this example project.

distinctUntilChanged()
);

// paddle$.pipe(take(600)).subscribe(x => console.log(x));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that debug output?


// paddle$.pipe(take(600)).subscribe(x => console.log(x));

const object$ = ticker$.pipe(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objects$? But that's just nitpicking, the singular is okay ;)

{
"semi": true,
"singleQuote": true
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding printWidth: 120 should prevent some of the weirder line breaks after formatting?


/** Game Loop **/
const game = combineLatest(ticker$, paddle$, object$)
// .pipe(sample(TICKER_INTERVAL))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the sampling not necessary anymore?

let audio;
let beeper = new Subject();

// Cant play sounds until after an interaction
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!


// Cant play sounds until after an interaction
fromEvent(document, 'keyup')
.toPromise()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this executed after each keyup? Can/should we add a take(1) or something like that here?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or does this complete after the first event?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that looks suspicious (I thought you needed complete for a toPromise to fulfill) , but it seemed to make a warning go away and bring sound back.

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.

2 participants