Commit fe473ce1 authored by Mathieu Lorber's avatar Mathieu Lorber Committed by Sindre Sorhus

Update

parent 0b2c6723
library uuid;
import 'dart:math';
Random _random = new Random();
String uuid() {
return "${_S4()}${_S4()}-${_S4()}-${_S4()}-${_S4()}-${_S4()}${_S4()}${_S4()}";
}
String _S4() {
return _random.nextInt(65536).toRadixString(16);
}
name: todomvc_vanilladart name: todomvc_vanilladart
version: 1.0.0 version: 1.0.1
description: TodoMVC built with Dart. Simple, vanilla Dart. description: TodoMVC built with Dart. Simple, vanilla Dart.
dependencies: dependencies:
browser: any browser: any
\ No newline at end of file
uuid: any
\ No newline at end of file
...@@ -2,8 +2,6 @@ part of todomvc; ...@@ -2,8 +2,6 @@ part of todomvc;
class TodoApp { class TodoApp {
static final Uuid uuid = new Uuid();
List<TodoWidget> todoWidgets = new List<TodoWidget>(); List<TodoWidget> todoWidgets = new List<TodoWidget>();
Element todoListElement = querySelector('#todo-list'); Element todoListElement = querySelector('#todo-list');
...@@ -44,7 +42,7 @@ class TodoApp { ...@@ -44,7 +42,7 @@ class TodoApp {
if (e.keyCode == KeyCode.ENTER) { if (e.keyCode == KeyCode.ENTER) {
var title = newTodoElement.value.trim(); var title = newTodoElement.value.trim();
if (title.isNotEmpty) { if (title.isNotEmpty) {
addTodo(new Todo(uuid.v4(), title)); addTodo(new Todo(uuid(), title));
newTodoElement.value = ''; newTodoElement.value = '';
updateFooterDisplay(); updateFooterDisplay();
save(); save();
......
...@@ -3,8 +3,8 @@ library todomvc; ...@@ -3,8 +3,8 @@ library todomvc;
import 'dart:html' import 'dart:html'
show Element, InputElement, KeyCode, KeyboardEvent, querySelector, window; show Element, InputElement, KeyCode, KeyboardEvent, querySelector, window;
import 'dart:convert' show HtmlEscape, JSON; import 'dart:convert' show HtmlEscape, JSON;
import 'package:uuid/uuid.dart'; import 'package:todomvc_vanilladart/models.dart';
import 'package:todomvc_vanilladart/models.dart' show Todo; import 'package:todomvc_vanilladart/uuid.dart';
part 'TodoWidget.dart'; part 'TodoWidget.dart';
part 'TodoApp.dart'; part 'TodoApp.dart';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment