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

Unified Diff: services/js/test/echo.js

Issue 767323002: Mojo JS Bindings: restore the ServiceProvider class, add an application test (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Removed console import from ServiceProvider Created 6 years 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 | « services/js/test/BUILD.gn ('k') | services/js/test/echo_service.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/js/test/echo.js
diff --git a/services/js/test/echo.js b/services/js/test/echo.js
new file mode 100644
index 0000000000000000000000000000000000000000..3fc286476a1f6849d08e4e0c86b5f3239ce22b2e
--- /dev/null
+++ b/services/js/test/echo.js
@@ -0,0 +1,32 @@
+#!mojo:js_content_handler
+
+define("main", [
+ "console",
+ "mojo/services/public/js/service-provider",
+ "services/js/test/echo_service.mojom",
+ "services/js/app-bridge",
+], function(console, spModule, echoModule, appModule) {
+
+ function Application(shell, url) {
+ this.shell = shell;
+ this.serviceProviders = [];
+ }
+
+ Application.prototype.initialize = function(args) {
+ }
+
+ Application.prototype.acceptConnection = function(url, spHandle) {
+ function EchoServiceImpl(client) {
+ this.echoString = function(s) {
+ if (s == "quit")
+ appModule.quit();
+ return Promise.resolve({value: s});
+ };
+ }
+ var serviceProvider = new spModule.ServiceProvider(spHandle);
+ serviceProvider.provideService(echoModule.EchoService, EchoServiceImpl);
+ this.serviceProviders.push(serviceProvider);
+ }
+
+ return Application;
+});
« no previous file with comments | « services/js/test/BUILD.gn ('k') | services/js/test/echo_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698