Index: sky/examples/fn/lib/event.dart |
diff --git a/sky/examples/fn/lib/event.dart b/sky/examples/fn/lib/event.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5b96d739d458207a586f7fe694d672e6d066c673 |
--- /dev/null |
+++ b/sky/examples/fn/lib/event.dart |
@@ -0,0 +1,25 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+part of fn; |
+ |
+class EventHandler { |
+ final String type; |
+ final sky.EventListener listener; |
+ |
+ EventHandler(this.type, this.listener); |
+} |
+ |
+class EventMap { |
+ final List<EventHandler> _handlers = new List<EventHandler>(); |
+ |
+ void listen(String type, sky.EventListener listener) { |
+ assert(listener != null); |
+ _handlers.add(new EventHandler(type, listener)); |
+ } |
+ |
+ void addAll(EventMap events) { |
+ _handlers.addAll(events._handlers); |
+ } |
+} |