1/*! 2 * ASP.NET SignalR JavaScript Library v2.3.0-rtm 3 * http://signalr.net/ 4 * 5 * Copyright (c) .NET Foundation. All rights reserved. 6 * Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 7 * 8 */ 9 10/// <reference path="..\..\SignalR.Client.JS\Scripts\jquery-1.6.4.js" /> 11/// <reference path="jquery.signalR.js" /> 12(function ($, window, undefined) { 13 /// <param name="$" type="jQuery" /> 14 "use strict"; 15 16 if (typeof ($.signalR) !== "function") { 17 throw new Error("SignalR: SignalR is not loaded. Please ensure jquery.signalR-x.js is referenced before ~/signalr/js."); 18 } 19 20 var signalR = $.signalR; 21 22 function makeProxyCallback(hub, callback) { 23 return function () { 24 // Call the client hub method 25 callback.apply(hub, $.makeArray(arguments)); 26 }; 27 } 28 29 function registerHubProxies(instance, shouldSubscribe) { 30 var key, hub, memberKey, memberValue, subscriptionMethod; 31 32 for (key in instance) { 33 if (instance.hasOwnProperty(key)) { 34 hub = instance[key]; 35 36 if (!(hub.hubName)) { 37 // Not a client hub 38 continue; 39 } 40 41 if (shouldSubscribe) { 42 // We want to subscribe to the hub events 43 subscriptionMethod = hub.on; 44 } else { 45 // We want to unsubscribe from the hub events 46 subscriptionMethod = hub.off; 47 } 48 49 // Loop through all members on the hub and find client hub functions to subscribe/unsubscribe 50 for (memberKey in hub.client) { 51 if (hub.client.hasOwnProperty(memberKey)) { 52 memberValue = hub.client[memberKey]; 53 54 if (!$.isFunction(memberValue)) { 55 // Not a client hub function 56 continue; 57 } 58 59 // Use the actual user-provided callback as the "identity" value for the registration. 60 subscriptionMethod.call(hub, memberKey, makeProxyCallback(hub, memberValue), memberValue); 61 } 62 } 63 } 64 } 65 } 66 67 $.hubConnection.prototype.createHubProxies = function () { 68 var proxies = {}; 69 this.starting(function () { 70 // Register the hub proxies as subscribed 71 // (instance, shouldSubscribe) 72 registerHubProxies(proxies, true); 73 74 this._registerSubscribedHubs(); 75 }).disconnected(function () { 76 // Unsubscribe all hub proxies when we "disconnect". This is to ensure that we do not re-add functional call backs. 77 // (instance, shouldSubscribe) 78 registerHubProxies(proxies, false); 79 }); 80 81 proxies['agentHub'] = this.createHubProxy('agentHub'); 82 proxies['agentHub'].client = { }; 83 proxies['agentHub'].server = { 84 printJob: function (args) { 85 return proxies['agentHub'].invoke.apply(proxies['agentHub'], $.merge(["PrintJob"], $.makeArray(arguments))); 86 }, 87 88 printTempDocument: function (tempDocumentId) { 89 return proxies['agentHub'].invoke.apply(proxies['agentHub'], $.merge(["PrintTempDocument"], $.makeArray(arguments))); 90 }, 91 92 registerAgent: function (machineName) { 93 return proxies['agentHub'].invoke.apply(proxies['agentHub'], $.merge(["RegisterAgent"], $.makeArray(arguments))); 94 } 95 }; 96 97 proxies['messageHub'] = this.createHubProxy('messageHub'); 98 proxies['messageHub'].client = { }; 99 proxies['messageHub'].server = { 100 notifyNewMessageAvailable: function (instanceId, userId) { 101 return proxies['messageHub'].invoke.apply(proxies['messageHub'], $.merge(["NotifyNewMessageAvailable"], $.makeArray(arguments))); 102 }, 103 104 registerUserId: function (userId) { 105 return proxies['messageHub'].invoke.apply(proxies['messageHub'], $.merge(["RegisterUserId"], $.makeArray(arguments))); 106 } 107 }; 108 109 return proxies; 110 }; 111 112 signalR.hub = $.hubConnection("/signalr", { useDefaultPath: fal
112se }); 113 $.extend(signalR, signalR.hub.createHubProxies()); 114 115}(window.jQuery, window));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.