mirror of
https://github.com/encounter/engine.git
synced 2026-03-30 11:09:55 -07:00
24 lines
805 B
Plaintext
24 lines
805 B
Plaintext
<link rel="import" href="/mojo/public/html/core.html" as="core" />
|
|
<link rel="import" href="/mojo/public/html/connection.html" as="connection" />
|
|
<script>
|
|
function wrapHandle(handle, service, client) {
|
|
var clientClass = client && service.client.delegatingStubClass;
|
|
var serviceConnection = new connection.Connection(
|
|
handle, clientClass, service.proxyClass);
|
|
if (serviceConnection.local)
|
|
serviceConnection.local.delegate$ = client;
|
|
serviceConnection.remote.connection$ = serviceConnection;
|
|
return serviceConnection.remote;
|
|
}
|
|
|
|
function connectToService(url, service, client) {
|
|
var handle = internals.connectToService(url, service.name);
|
|
return wrapHandle(handle, service, client);
|
|
}
|
|
|
|
module.exports = {
|
|
connectToService: connectToService,
|
|
wrapHandle: wrapHandle,
|
|
};
|
|
</script>
|