7516e95066
BUG= Review URL: https://codereview.chromium.org//410863002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38488 260f80e4-7a28-3924-810f-c04153c831b5
39 lines
991 B
Plaintext
39 lines
991 B
Plaintext
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// for details. 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 $LIBRARYNAME;
|
|
|
|
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
|
|
|
/**
|
|
* Provides a Future which will be completed once the transaction has
|
|
* completed.
|
|
*
|
|
* The future will error if an error occurrs on the transaction or if the
|
|
* transaction is aborted.
|
|
*/
|
|
Future<Database> get completed {
|
|
var completer = new Completer<Database>();
|
|
|
|
this.onComplete.first.then((_) {
|
|
completer.complete(db);
|
|
});
|
|
|
|
this.onError.first.then((e) {
|
|
completer.completeError(e);
|
|
});
|
|
|
|
this.onAbort.first.then((e) {
|
|
// Avoid completing twice if an error occurs.
|
|
if (!completer.isCompleted) {
|
|
completer.completeError(e);
|
|
}
|
|
});
|
|
|
|
return completer.future;
|
|
}
|
|
|
|
$!MEMBERS
|
|
}
|