OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 define("mojo/apps/js/mojo", [ | |
6 "mojo/public/js/bindings/connection", | |
7 "mojo/apps/js/bridge", | |
8 ], function(connection, mojo) { | |
9 | |
10 function connectToService(url, service, client) { | |
11 var serviceHandle = mojo.connectToService(url, service.name); | |
12 var clientClass = client && service.client.delegatingStubClass; | |
13 var serviceConnection = | |
14 new connection.Connection(serviceHandle, clientClass, service.proxyClass); | |
15 if (serviceConnection.local) | |
16 serviceConnection.local.delegate$ = client; | |
17 serviceConnection.remote.connection$ = serviceConnection; | |
18 return serviceConnection.remote; | |
19 } | |
20 | |
21 var exports = {}; | |
22 exports.connectToService = connectToService; | |
23 exports.quit = mojo.quit; | |
24 return exports; | |
25 }); | |
26 | |
OLD | NEW |