feat(WebWorkers): Add WebSocket MessageBuses for debugging apps
Closes #3858
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
import {NgFor, Component, View, FORM_DIRECTIVES} from 'angular2/angular2';
|
||||
import {NgFor} from 'angular2/src/core/directives/ng_for';
|
||||
import {View, Component} from 'angular2/src/core/metadata';
|
||||
import {FORM_DIRECTIVES} from 'angular2/src/forms/directives';
|
||||
import {Store, Todo, TodoFactory} from './services/TodoStore';
|
||||
|
||||
@Component({selector: 'todo-app', viewBindings: [Store, TodoFactory]})
|
||||
|
16
modules/examples/src/web_workers/todo/index_web_socket.dart
Normal file
16
modules/examples/src/web_workers/todo/index_web_socket.dart
Normal file
@ -0,0 +1,16 @@
|
||||
library angular2.examples.web_workers.todo.index_web_socket;
|
||||
|
||||
import "package:angular2/src/core/reflection/reflection_capabilities.dart";
|
||||
import "package:angular2/src/core/reflection/reflection.dart";
|
||||
import "package:angular2/src/web_workers/ui/impl.dart" show bootstrapUICommon;
|
||||
import "package:angular2/src/web_workers/debug_tools/web_socket_message_bus.dart";
|
||||
import 'dart:html'
|
||||
show WebSocket;
|
||||
|
||||
main() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
var webSocket = new WebSocket("ws://127.0.0.1:1337/ws");
|
||||
var bus = new WebSocketMessageBus.fromWebSocket(webSocket);
|
||||
|
||||
bootstrapUICommon(bus);
|
||||
}
|
13
modules/examples/src/web_workers/todo/index_web_socket.html
Normal file
13
modules/examples/src/web_workers/todo/index_web_socket.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<title>Todo Angular 2 - WebWorker</title>
|
||||
<link rel="stylesheet" href="css/main.css" media="screen" title="no title" charset="utf-8">
|
||||
<body>
|
||||
<todo-app>
|
||||
Loading...
|
||||
</todo-app>
|
||||
|
||||
|
||||
$SCRIPTS$
|
||||
</body>
|
||||
</html>
|
16
modules/examples/src/web_workers/todo/server_index.dart
Normal file
16
modules/examples/src/web_workers/todo/server_index.dart
Normal file
@ -0,0 +1,16 @@
|
||||
library angular2.examples.web_workers.todo.server_index;
|
||||
import "index_common.dart" show TodoApp;
|
||||
import "package:angular2/src/web_workers/debug_tools/multi_client_server_message_bus.dart";
|
||||
import "package:angular2/src/web_workers/worker/application_common.dart"
|
||||
show bootstrapWebWorkerCommon;
|
||||
import 'dart:io';
|
||||
import "package:angular2/src/core/reflection/reflection_capabilities.dart";
|
||||
import "package:angular2/src/core/reflection/reflection.dart";
|
||||
|
||||
void main() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
HttpServer.bind('127.0.0.1', 1337).then((HttpServer server) {
|
||||
var bus = new MultiClientServerMessageBus.fromHttpServer(server);
|
||||
bootstrapWebWorkerCommon(TodoApp, bus).catchError((error) => throw error);
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user