style(dart): Run dartfmt v0.1.8+2 on all pure Dart code
Update formatting for all pure Dart code in the repo.
This commit is contained in:
@ -5,8 +5,7 @@ import 'dart:async';
|
||||
import 'dart:core';
|
||||
import 'package:angular2/src/web-workers/shared/message_bus.dart'
|
||||
show MessageBus, MessageBusSink, MessageBusSource;
|
||||
import 'package:angular2/src/web-workers/ui/impl.dart'
|
||||
show bootstrapUICommon;
|
||||
import 'package:angular2/src/web-workers/ui/impl.dart' show bootstrapUICommon;
|
||||
|
||||
/**
|
||||
* Bootstrapping a WebWorker
|
||||
@ -23,7 +22,7 @@ void bootstrap(String uri) {
|
||||
/**
|
||||
* To be called from the main thread to spawn and communicate with the worker thread
|
||||
*/
|
||||
Future<UIMessageBus> spawnWorker(Uri uri){
|
||||
Future<UIMessageBus> spawnWorker(Uri uri) {
|
||||
var receivePort = new ReceivePort();
|
||||
var isolateEndSendPort = receivePort.sendPort;
|
||||
return Isolate.spawnUri(uri, const [], isolateEndSendPort).then((_) {
|
||||
@ -57,7 +56,8 @@ class UIMessageBusSink extends MessageBusSink {
|
||||
class UIMessageBusSource extends MessageBusSource {
|
||||
final ReceivePort _port;
|
||||
final Stream rawDataStream;
|
||||
Map<int, StreamSubscription> _listenerStore = new Map<int, StreamSubscription>();
|
||||
Map<int, StreamSubscription> _listenerStore =
|
||||
new Map<int, StreamSubscription>();
|
||||
int _numListeners = 0;
|
||||
|
||||
UIMessageBusSource(ReceivePort port)
|
||||
@ -68,8 +68,8 @@ class UIMessageBusSource extends MessageBusSource {
|
||||
return message is SendPort;
|
||||
});
|
||||
|
||||
int addListener(Function fn){
|
||||
var subscription = rawDataStream.listen((message){
|
||||
int addListener(Function fn) {
|
||||
var subscription = rawDataStream.listen((message) {
|
||||
fn({"data": message});
|
||||
});
|
||||
|
||||
@ -77,7 +77,7 @@ class UIMessageBusSource extends MessageBusSource {
|
||||
return _numListeners;
|
||||
}
|
||||
|
||||
void removeListener(int index){
|
||||
void removeListener(int index) {
|
||||
_listenerStore[index].cancel();
|
||||
_listenerStore.remove(index);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ library angular2.src.web_workers.worker;
|
||||
import "package:angular2/src/web-workers/shared/message_bus.dart"
|
||||
show MessageBus, MessageBusSource, MessageBusSink;
|
||||
import "package:angular2/src/web-workers/worker/application_common.dart"
|
||||
show bootstrapWebworkerCommon;
|
||||
show bootstrapWebworkerCommon;
|
||||
import "package:angular2/src/facade/async.dart" show Future;
|
||||
import "package:angular2/src/core/application.dart" show ApplicationRef;
|
||||
import "package:angular2/src/facade/lang.dart" show Type, BaseException;
|
||||
@ -27,8 +27,8 @@ Future<ApplicationRef> bootstrapWebworker(
|
||||
[List<dynamic> componentInjectableBindings = null]) {
|
||||
ReceivePort rPort = new ReceivePort();
|
||||
WorkerMessageBus bus = new WorkerMessageBus.fromPorts(replyTo, rPort);
|
||||
return bootstrapWebworkerCommon(appComponentType, bus,
|
||||
componentInjectableBindings);
|
||||
return bootstrapWebworkerCommon(
|
||||
appComponentType, bus, componentInjectableBindings);
|
||||
}
|
||||
|
||||
class WorkerMessageBus extends MessageBus {
|
||||
@ -57,15 +57,16 @@ class WorkerMessageBusSink extends MessageBusSink {
|
||||
class WorkerMessageBusSource extends MessageBusSource {
|
||||
final ReceivePort _port;
|
||||
final Stream rawDataStream;
|
||||
Map<int, StreamSubscription> _listenerStore = new Map<int, StreamSubscription>();
|
||||
Map<int, StreamSubscription> _listenerStore =
|
||||
new Map<int, StreamSubscription>();
|
||||
int _numListeners = 0;
|
||||
|
||||
WorkerMessageBusSource(ReceivePort rPort)
|
||||
: _port = rPort,
|
||||
rawDataStream = rPort.asBroadcastStream();
|
||||
|
||||
int addListener(Function fn){
|
||||
var subscription = rawDataStream.listen((message){
|
||||
int addListener(Function fn) {
|
||||
var subscription = rawDataStream.listen((message) {
|
||||
fn({"data": message});
|
||||
});
|
||||
|
||||
@ -73,7 +74,7 @@ class WorkerMessageBusSource extends MessageBusSource {
|
||||
return _numListeners;
|
||||
}
|
||||
|
||||
void removeListener(int index){
|
||||
void removeListener(int index) {
|
||||
_listenerStore[index].cancel();
|
||||
_listenerStore.remove(index);
|
||||
}
|
||||
|
Reference in New Issue
Block a user