Click here to Skip to main content
15,889,693 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Kevin Marois8-Mar-17 8:08
professionalKevin Marois8-Mar-17 8:08 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Richard Deeming8-Mar-17 8:10
mveRichard Deeming8-Mar-17 8:10 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Kevin Marois8-Mar-17 8:11
professionalKevin Marois8-Mar-17 8:11 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Richard Deeming8-Mar-17 8:13
mveRichard Deeming8-Mar-17 8:13 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Kevin Marois8-Mar-17 8:17
professionalKevin Marois8-Mar-17 8:17 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Richard Deeming8-Mar-17 8:22
mveRichard Deeming8-Mar-17 8:22 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Kevin Marois8-Mar-17 8:26
professionalKevin Marois8-Mar-17 8:26 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Kevin Marois8-Mar-17 8:27
professionalKevin Marois8-Mar-17 8:27 
Here's the Hubs JS
JavaScript
(function ($, window, undefined) {
    /// <param name="$" type="jQuery" />
    "use strict";

    if (typeof ($.signalR) !== "function") {
        throw new Error("SignalR: SignalR is not loaded. Please ensure jquery.signalR-x.js is referenced before ~/signalr/js.");
    }

    var signalR = $.signalR;

    function makeProxyCallback(hub, callback) {
        return function () {
            // Call the client hub method
            callback.apply(hub, $.makeArray(arguments));
        };
    }

    function registerHubProxies(instance, shouldSubscribe) {
        var key, hub, memberKey, memberValue, subscriptionMethod;

        for (key in instance) {
            if (instance.hasOwnProperty(key)) {
                hub = instance[key];

                if (!(hub.hubName)) {
                    // Not a client hub
                    continue;
                }

                if (shouldSubscribe) {
                    // We want to subscribe to the hub events
                    subscriptionMethod = hub.on;
                } else {
                    // We want to unsubscribe from the hub events
                    subscriptionMethod = hub.off;
                }

                // Loop through all members on the hub and find client hub functions to subscribe/unsubscribe
                for (memberKey in hub.client) {
                    if (hub.client.hasOwnProperty(memberKey)) {
                        memberValue = hub.client[memberKey];

                        if (!$.isFunction(memberValue)) {
                            // Not a client hub function
                            continue;
                        }

                        subscriptionMethod.call(hub, memberKey, makeProxyCallback(hub, memberValue));
                    }
                }
            }
        }
    }

    $.hubConnection.prototype.createHubProxies = function () {
        var proxies = {};
        this.starting(function () {
            // Register the hub proxies as subscribed
            // (instance, shouldSubscribe)
            registerHubProxies(proxies, true);

            this._registerSubscribedHubs();
        }).disconnected(function () {
            // Unsubscribe all hub proxies when we "disconnect".  This is to ensure that we do not re-add functional call backs.
            // (instance, shouldSubscribe)
            registerHubProxies(proxies, false);
        });

        return proxies;
    };

    signalR.hub = $.hubConnection("/signalr", { useDefaultPath: false });
    $.extend(signalR, signalR.hub.createHubProxies());

}(window.jQuery, window));
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

GeneralRe: OK, What Am I doing Wrong ???? Pin
Richard Deeming8-Mar-17 8:40
mveRichard Deeming8-Mar-17 8:40 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Kevin Marois8-Mar-17 8:42
professionalKevin Marois8-Mar-17 8:42 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Richard Deeming8-Mar-17 8:53
mveRichard Deeming8-Mar-17 8:53 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Kevin Marois8-Mar-17 10:28
professionalKevin Marois8-Mar-17 10:28 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Richard MacCutchan8-Mar-17 21:23
mveRichard MacCutchan8-Mar-17 21:23 
Questionunexpected character EOF Pin
Member 110313048-Mar-17 1:02
Member 110313048-Mar-17 1:02 
AnswerRe: unexpected character EOF Pin
Nathan Minier8-Mar-17 1:15
professionalNathan Minier8-Mar-17 1:15 
GeneralRe: unexpected character EOF Pin
Member 110313048-Mar-17 1:56
Member 110313048-Mar-17 1:56 
GeneralRe: unexpected character EOF Pin
Nathan Minier8-Mar-17 2:02
professionalNathan Minier8-Mar-17 2:02 
QuestionNext Issue - Script Bundle Problem? Pin
Kevin Marois7-Mar-17 11:59
professionalKevin Marois7-Mar-17 11:59 
AnswerRe: Next Issue - Script Bundle Problem? Pin
Nathan Minier8-Mar-17 1:21
professionalNathan Minier8-Mar-17 1:21 
GeneralRe: Next Issue - Script Bundle Problem? Pin
Kevin Marois8-Mar-17 3:59
professionalKevin Marois8-Mar-17 3:59 
QuestionSetting URL Pin
Kevin Marois7-Mar-17 8:22
professionalKevin Marois7-Mar-17 8:22 
AnswerRe: Setting URL Pin
ZurdoDev7-Mar-17 9:21
professionalZurdoDev7-Mar-17 9:21 
GeneralRe: Setting URL Pin
Kevin Marois7-Mar-17 10:47
professionalKevin Marois7-Mar-17 10:47 
AnswerRe: Page appearing way to wide. Pin
Richard MacCutchan3-Mar-17 21:14
mveRichard MacCutchan3-Mar-17 21:14 
AnswerRe: Page appearing way to wide. Pin
ZurdoDev7-Mar-17 9:23
professionalZurdoDev7-Mar-17 9:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.