Showing posts from February, 2013

Exploring Dart's Async Library

(Warning: work in progress...) Use Dart's async library to keep work off the main UI thread and help your users have a smooth and performant experience. The dart:async library contains classes for timers, futures, streams, and more. Effective use of dart:async keeps your apps easier to understand and your UI snappy. Telling the future is easier when you have all the data. The event loop Or, why this all matters. Dart programs, just like JavaScript, have no shared-state threads. The UI and the program use the same thread of execution, so when the UI is updating the program isn't running. Conversely, when the programming is running, the UI isn't updating. Keeping work off of the main thread means more time for the UI to respond to user input, which means the UI feels snappy and responsive. The runtime maintains an event loop and a queue of work to perform. The event loops pops work items off of the queue, one after another. While one work item is handled, the

Lawndart helps you write offline web apps

I'm happy to announce my new Lawndart library for Dart, which helps you build offline-enabled modern web apps. Using Lawndart, you can use a consistent and easy interface no matter what underlying storage mechanism is supported. These things are seriously dangerous. The toy, not the source code. Lawndart was initially inspired by lawnchair , a JavaScript library that helps to provide a consistent interface across client-side storage. However, Lawndart evolved and adopted a Future based API for more composable methods. Available in version 0.2.0: Unified API for in-memory, local storage, indexed db, and websql Future-based APIs Tests Example Web UI app with IndexedDB Here is an example of using Lawndart to open, clear, save, and retrieve data: var store = new IndexedDbAdapter('teststore', 'testdb'); .then((_) => store.nuke()) .then((_) =>, "hello")) .then((_) =>"i

Slides from JFokus talk on Dart and Web Components

I had the pleasure of presenting "Web Components Now: Dart and Web UI" at JFokus 2013. In this presentation, I covered the new hotness coming to the web platform and how Dart helps to bring much of to modern browsers today. Encapsulation, templates, custom elements, and dynamic data-driven views are made available thanks to Dart's Web UI library (heavily inspired by Web Components and Model-Driven Views). The slides are now available. WARNING : You might need Chrome Canary to see all the demos in action. In the presentation, I covered topics such as: Web Components Shadow DOM Custom elements Dart language and libraries Dart's toolchain Dart's Web UI library (a polyfill for Web Components and MDV-esque behavior) If you're interested in these topics, you can learn more about Dart and Web UI . JFokus was a blast. Great conference, friendly crowd, excellent A/V setup! As an old Java developer, it felt good showing off the hotness of mo

Bite-sized Dart videos

For the past month I've been working with Marakana to film and produce short, bite-sized introduction videos for the Dart language and libraries. After filming lots of various videos and formats, I've noticed that viewer retention is difficult. It's so easy to simply click away at any time. Our long-form videos are difficult to watch all the way through. So, we're swinging over to the other end of the spectrum with super-short, targeted videos. The result: Dart Tips , for when you have only 5 minutes to learn something new about Dart . From " Functions are Fun, pt 1 " Six videos have been released so far. Topics include: Reading a Dart script Dart runtime modes Built-in types Variables Collections Functions You can see the entire playlist for Dart Tips  for all the episodes. For a taste, here's "Functions are fun, pt 1": Marakana has been great to work with. They are professional, fun, and like to experiment with new tec