-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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 for Dart 1.0 release #731
Conversation
@@ -43,7 +45,7 @@ class TodoApp { | |||
if (e.keyCode == KeyCode.ENTER) { | |||
var title = newTodoElement.value.trim(); | |||
if (title != '') { | |||
addTodo(new Todo(UUID.createUuid(), title)); | |||
addTodo(new Todo(uuid.v4(), title)); |
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.
since it's only used once:
addTodo(new Todo((new Uuid()).v4(), title));
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.
It's used each time you add a task, and Uuid construction isn't free
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.
alright
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.
Same thing for HTML escape, I'm even thinking it could be global.
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.
Ok, HtmlEscape construction is free, so let's forget about it.
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.
I have no clue what best practises in Dart are, but aren't there const and final modifiers that could be applied to this?
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.
They could actually be both (uuid and htmlescape) static & final... I look at that
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.
Sweet!
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.
I pushed it.
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.
BTW, a lot more fields could be final (all fields in TodoApp.dart actually)... I'm not a "final extremist" + not sure it worthwhile here... WDYT ?
I did not though to the link in todomvc.com . Do I forget another one ? |
No more absolute path in sourcemap but still, relative paths to the dart sdk were relative to my environnement |
@sethladd if you have any time this week to help us review the Dart 1.0 changes to the app that would be hugely appreciated. Thanks! |
Happy to help. Looks like I can check this out tomorrow if that's ok? |
sure |
@@ -1,6 +1,9 @@ | |||
part of todomvc; | |||
|
|||
class TodoApp { | |||
|
|||
static final uuid = new Uuid(); |
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.
Use a type annotation here. Put them on static fields for better code completion and documentation.
It would be really nice if the app follow pub conventions. That way we can run pub build to create a nice output directory. Is it OK if we had both a web/ and a build/ checked into TodoMVC? web/ would be the source and build/ would be the output. |
Yes |
+1. Thanks for the review, @sethladd! Also, here in Paris atm with @MathieuLorber :) |
@MathieuLorber could you create a web directory, move the HTML, Dart, etc files into it, and then run pub build, which generated a build/ dir, and then check all that in? :) |
Yep I didn't forgot =]. Pretty busy last days, I work on your code review soon ! |
No problem, thanks! |
Ok so if I understand the result of pub build, index.html is supposed to be in /web and get copied to /build ? There is no standard way to have an unique index.html which opens dart or js depending on the browser ? |
That's also very relevant for the AngularDart submission. |
Why do we need base.js? That generates an AJAX request for getFile('learn.json', Learn); which is an error. |
See MathieuLorber#1 because I couldn't find a good way to comment on random bits of code (unless that code was part of this diff? How do I leave a comment on a non-diff code?) |
@sethladd |
lgtm, can we merge? Thanks! 🎉 |
@sethladd Some of your comments aren't addressed in the current version, like missing type annotations for UUID. |
Sorry I couldn't look at it during last days. I'm just wondering one thing (can't verify right now), does the compiled version works without doing pub install first ? I'm thinking about dart.js for example |
@MathieuLorber No worries! I found two issues wrt spec compliance:
|
Thanks @passy ! We can fix those. @MathieuLorber it should work out of the box, as long as you open and run from build/ |
Hitting ESC now clears out the input. Entries are trimmed for me. That seemed to work before. I assume you mean entering " hello " gets trimmed to "hello" ? |
Apologies, this PR is not off the branch I was using. I think I need to send over a new PR. |
I think we should close this PR and move the conversation over to #748 |
Sorry @sethladd , actually you commited on a branch I created for tests, I wanted to merge it to the branch of this PR when all was ok... But no problem =) |
A refresh for the release of Dart 1.0 !
As a result of libs use, the final compiled file is now 200k instead of 130. Pruning is not completely ok yet i guess =]. Using librairies still seems to be the good practice to me...
Sorry for previous PR, I did not merged my repo properly =/