
Previously these symbols were exposed via platform-browser-dynamic, then we merged then into platform-browser thinking that tools would know how to shake off the compiler and other dynamic bits not used with the offline compilation flow. This turned out to be wrong as both webpack and rollup don't have good enough tree-shaking capabilities to do this today. We think that in the future we'll be able to merge these two entry points into one, but we need to give tooling some time before we can do it. In the meantime the reintroduction of the -dynamic package point allows us to separate the compiler dependencies from the rest of the framework. This change undoes the previous breaking change that removed the platform-browser-dynamic package.
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import {ApplicationRef} from '@angular/core';
|
|
import {UiArguments, FnArg, PRIMITIVE, ClientMessageBrokerFactory} from '@angular/platform-browser';
|
|
import {bootstrapRender} from "@angular/platform-browser-dynamic";
|
|
|
|
const ECHO_CHANNEL = "ECHO";
|
|
|
|
export function main() {
|
|
bootstrapRender("loader.js").then((ref) => afterBootstrap(ref));
|
|
}
|
|
|
|
function afterBootstrap(ref: ApplicationRef) {
|
|
let brokerFactory: ClientMessageBrokerFactory = ref.injector.get(ClientMessageBrokerFactory);
|
|
var broker = brokerFactory.createMessageBroker(ECHO_CHANNEL, false);
|
|
|
|
document.getElementById("send_echo")
|
|
.addEventListener("click", (e) => {
|
|
var val = (<HTMLInputElement>document.getElementById("echo_input")).value;
|
|
// TODO(jteplitz602): Replace default constructors with real constructors
|
|
// once they're in the .d.ts file (#3926)
|
|
var args = new UiArguments("echo");
|
|
args.method = "echo";
|
|
var fnArg = new FnArg(val, PRIMITIVE);
|
|
fnArg.value = val;
|
|
fnArg.type = PRIMITIVE;
|
|
args.args = [fnArg];
|
|
|
|
broker.runOnService(args, PRIMITIVE)
|
|
.then((echo_result: string) => {
|
|
document.getElementById("echo_result").innerHTML =
|
|
`<span class='response'>${echo_result}</span>`;
|
|
});
|
|
});
|
|
}
|