Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: sdk/lib/indexed_db/dartium/indexed_db_dartium.dart

Issue 11824072: Adding streams to dart:html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review feedback Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart ('k') | sdk/lib/svg/dart2js/svg_dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
diff --git a/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart b/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
index 445f2febef3652cf7d2dabdf9d19447b82e402d2..74a659876ae6111c7b1079556e74141254c9018b 100644
--- a/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
+++ b/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
@@ -1,5 +1,6 @@
library indexed_db;
+import 'dart:async';
import 'dart:html';
import 'dart:html_common';
import 'dart:nativewrappers';
@@ -119,6 +120,12 @@ class CursorWithValue extends Cursor {
class Database extends EventTarget {
Database.internal() : super.internal();
+ static const EventStreamProvider<Event> abortEvent = const EventStreamProvider<Event>('abort');
+
+ static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error');
+
+ static const EventStreamProvider<UpgradeNeededEvent> versionChangeEvent = const EventStreamProvider<UpgradeNeededEvent>('versionchange');
+
/// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true
DatabaseEvents get on =>
new DatabaseEvents(this);
@@ -184,6 +191,12 @@ class Database extends EventTarget {
/** @domName IDBDatabase.transaction_3 */
Transaction _transaction_3(storeName_OR_storeNames, mode) native "IDBDatabase_transaction_3_Callback";
+ Stream<Event> get onAbort => abortEvent.forTarget(this);
+
+ Stream<Event> get onError => errorEvent.forTarget(this);
+
+ Stream<UpgradeNeededEvent> get onVersionChange => versionChangeEvent.forTarget(this);
+
}
/// @docsEditable true
@@ -742,10 +755,18 @@ class ObjectStore extends NativeFieldWrapperClass1 {
class OpenDBRequest extends Request implements EventTarget {
OpenDBRequest.internal() : super.internal();
+ static const EventStreamProvider<Event> blockedEvent = const EventStreamProvider<Event>('blocked');
+
+ static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = const EventStreamProvider<VersionChangeEvent>('upgradeneeded');
+
/// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true
OpenDBRequestEvents get on =>
new OpenDBRequestEvents(this);
+ Stream<Event> get onBlocked => blockedEvent.forTarget(this);
+
+ Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget(this);
+
}
/// @docsEditable true
@@ -770,6 +791,10 @@ class OpenDBRequestEvents extends RequestEvents {
class Request extends EventTarget {
Request.internal() : super.internal();
+ static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error');
+
+ static const EventStreamProvider<Event> successEvent = const EventStreamProvider<Event>('success');
+
/// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true
RequestEvents get on =>
new RequestEvents(this);
@@ -810,6 +835,10 @@ class Request extends EventTarget {
/** @domName IDBRequest.removeEventListener */
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "IDBRequest_removeEventListener_Callback";
+ Stream<Event> get onError => errorEvent.forTarget(this);
+
+ Stream<Event> get onSuccess => successEvent.forTarget(this);
+
}
/// @docsEditable true
@@ -834,6 +863,12 @@ class RequestEvents extends Events {
class Transaction extends EventTarget {
Transaction.internal() : super.internal();
+ static const EventStreamProvider<Event> abortEvent = const EventStreamProvider<Event>('abort');
+
+ static const EventStreamProvider<Event> completeEvent = const EventStreamProvider<Event>('complete');
+
+ static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error');
+
/// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true
TransactionEvents get on =>
new TransactionEvents(this);
@@ -874,6 +909,12 @@ class Transaction extends EventTarget {
/** @domName IDBTransaction.removeEventListener */
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "IDBTransaction_removeEventListener_Callback";
+ Stream<Event> get onAbort => abortEvent.forTarget(this);
+
+ Stream<Event> get onComplete => completeEvent.forTarget(this);
+
+ Stream<Event> get onError => errorEvent.forTarget(this);
+
}
/// @docsEditable true
@@ -937,10 +978,14 @@ class VersionChangeEvent extends Event {
class VersionChangeRequest extends Request implements EventTarget {
VersionChangeRequest.internal() : super.internal();
+ static const EventStreamProvider<Event> blockedEvent = const EventStreamProvider<Event>('blocked');
+
/// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true
VersionChangeRequestEvents get on =>
new VersionChangeRequestEvents(this);
+ Stream<Event> get onBlocked => blockedEvent.forTarget(this);
+
}
/// @docsEditable true
« no previous file with comments | « sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart ('k') | sdk/lib/svg/dart2js/svg_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698