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

Unified Diff: mojo/apps/js/mojo.js

Issue 637373002: Mojo JS bindings: simplify mojo.connectToService() usage - Part 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed the mojo_internals module, made Connection localFactory optional Created 6 years, 2 months 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 | « mojo/apps/js/main.js ('k') | mojo/apps/js/mojo_bridge_module.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/apps/js/mojo.js
diff --git a/mojo/apps/js/mojo.js b/mojo/apps/js/mojo.js
new file mode 100644
index 0000000000000000000000000000000000000000..23bacffa5290bf65f29576b6c5cdec8aa0563fc3
--- /dev/null
+++ b/mojo/apps/js/mojo.js
@@ -0,0 +1,26 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+define("mojo/apps/js/mojo", [
+ "mojo/public/js/bindings/connection",
+ "mojo/apps/js/bridge",
+], function(connection, mojo) {
+
+ function connectToService(url, service, client) {
+ var serviceHandle = mojo.connectToService(url, service.name);
+ var clientClass = client && service.client.delegatingStubClass;
+ var serviceConnection =
+ new connection.Connection(serviceHandle, clientClass, service.proxyClass);
+ if (serviceConnection.local)
+ serviceConnection.local.delegate$ = client;
+ serviceConnection.remote.connection$ = serviceConnection;
+ return serviceConnection.remote;
+ }
+
+ var exports = {};
+ exports.connectToService = connectToService;
+ exports.quit = mojo.quit;
+ return exports;
+});
+
« no previous file with comments | « mojo/apps/js/main.js ('k') | mojo/apps/js/mojo_bridge_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698