1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-25 01:06:30 +00:00

update js libraries

This commit is contained in:
kay.one 2013-08-12 19:51:47 -07:00
parent d8da292516
commit 1675f35aa4
3 changed files with 658 additions and 516 deletions

View file

@ -1,7 +1,7 @@
/* jquery.signalR.core.js */
/*global window:false */
/*!
* ASP.NET SignalR JavaScript Library v1.1.2
* ASP.NET SignalR JavaScript Library v1.1.3
* http://signalr.net/
*
* Copyright Microsoft Open Technologies, Inc. All rights reserved.
@ -457,7 +457,7 @@
// Timeout to designate when to force the connection into reconnecting converted to milliseconds
keepAliveData.timeout = res.KeepAliveTimeout * 1000;
// Timeout to designate when to warn the developer that the connection may be dead or is hanging.
// Timeout to designate when to warn the developer that the connection may be dead or is not responding.
keepAliveData.timeoutWarning = keepAliveData.timeout * connection.keepAliveWarnAt;
// Instantiate the frequency in which we check the keep alive. It must be short in order to not miss/pick up any changes
@ -880,7 +880,7 @@
// so just hack around it on the client for now.
return;
}
$(connection).triggerHandler(events.onError, [errData]);
$(connection).triggerHandler(events.onError, [errData, data]);
}
});
},
@ -1803,9 +1803,7 @@
"use strict";
// we use a global id for tracking callbacks so the server doesn't have to send extra info like hub name
var callbackId = 0,
callbacks = {},
eventNamespace = ".hubProxy";
var eventNamespace = ".hubProxy";
function makeEventName(event) {
return event + eventNamespace;
@ -1839,6 +1837,28 @@
return false;
}
function clearInvocationCallbacks(connection, error) {
/// <param name="connection" type="hubConnection" />
var callbacks = connection._.invocationCallbacks,
callback;
connection.log("Clearing hub invocation callbacks with error: " + error);
// Reset the callback cache now as we have a local var referencing it
connection._.invocationCallbackId = 0;
delete connection._.invocationCallbacks;
connection._.invocationCallbacks = {};
// Loop over the callbacks and invoke them.
// We do this using a local var reference and *after* we've cleared the cache
// so that if a fail callback itself tries to invoke another method we don't
// end up with its callback in the list we're looping over.
for (var callbackId in callbacks) {
callback = callbacks[callbackId];
callback.method.call(callback.scope, { E: error });
}
}
// hubProxy
function hubProxy(hubConnection, hubName) {
/// <summary>
@ -1929,9 +1949,10 @@
/// <param name="methodName" type="String">The name of the server hub method.</param>
var self = this,
connection = self.connection,
args = $.makeArray(arguments).slice(1),
argValues = map(args, getArgValue),
data = { H: self.hubName, M: methodName, A: argValues, I: callbackId },
data = { H: self.hubName, M: methodName, A: argValues, I: connection._.invocationCallbackId },
d = $.Deferred(),
callback = function (minResult) {
var result = self._maximizeHubResponse(minResult);
@ -1942,7 +1963,7 @@
if (result.Error) {
// Server hub method threw an exception, log it & reject the deferred
if (result.StackTrace) {
self.connection.log(result.Error + "\n" + result.StackTrace);
connection.log(result.Error + "\n" + result.StackTrace);
}
d.rejectWith(self, [result.Error]);
} else {
@ -1951,14 +1972,14 @@
}
};
callbacks[callbackId.toString()] = { scope: self, method: callback };
callbackId += 1;
connection._.invocationCallbacks[connection._.invocationCallbackId.toString()] = { scope: self, method: callback };
connection._.invocationCallbackId += 1;
if (!$.isEmptyObject(self.state)) {
data.S = self.state;
}
self.connection.send(window.JSON.stringify(data));
connection.send(window.JSON.stringify(data));
return d.promise();
},
@ -1999,10 +2020,10 @@
hubConnection.fn.init = function (url, options) {
var settings = {
qs: null,
logging: false,
useDefaultPath: true
},
qs: null,
logging: false,
useDefaultPath: true
},
connection = this;
$.extend(settings, options);
@ -2013,6 +2034,9 @@
// Object to store hub proxies for this connection
connection.proxies = {};
connection._.invocationCallbackId = 0;
connection._.invocationCallbacks = {};
// Wire up the received handler
connection.received(function (minData) {
var data, proxy, dataCallbackId, callback, hubName, eventName;
@ -2023,11 +2047,11 @@
if (typeof (minData.I) !== "undefined") {
// We received the return value from a server method invocation, look up callback by id and call it
dataCallbackId = minData.I.toString();
callback = callbacks[dataCallbackId];
callback = connection._.invocationCallbacks[dataCallbackId];
if (callback) {
// Delete the callback from the proxy
callbacks[dataCallbackId] = null;
delete callbacks[dataCallbackId];
connection._.invocationCallbacks[dataCallbackId] = null;
delete connection._.invocationCallbacks[dataCallbackId];
// Invoke the callback
callback.method.call(callback.scope, minData);
@ -2050,6 +2074,52 @@
$(proxy).triggerHandler(makeEventName(eventName), [data.Args]);
}
});
connection.error(function (errData, origData) {
var data, callbackId, callback;
if (connection.transport && connection.transport.name === "webSockets") {
// WebSockets connections have all callbacks removed on reconnect instead
// as WebSockets sends are fire & forget
return;
}
if (!origData) {
// No original data passed so this is not a send error
return;
}
try {
data = window.JSON.parse(origData);
if (!data.I) {
// The original data doesn't have a callback ID so not a send error
return;
}
} catch (e) {
// The original data is not a JSON payload so this is not a send error
return;
}
callbackId = data.I;
callback = connection._.invocationCallbacks[callbackId];
// Invoke the callback with an error to reject the promise
callback.method.call(callback.scope, { E: errData });
// Delete the callback
connection._.invocationCallbacks[callbackId] = null;
delete connection._.invocationCallbacks[callbackId];
});
connection.reconnecting(function () {
if (connection.transport && connection.transport.name === "webSockets") {
clearInvocationCallbacks(connection, "Connection started reconnecting before invocation result was received.");
}
});
connection.disconnected(function () {
clearInvocationCallbacks(connection, "Connection was disconnected before invocation result was received.");
});
};
hubConnection.fn._maximizeClientHubInvocation = function (minClientHubInvocation) {
@ -2119,5 +2189,5 @@
/*global window:false */
/// <reference path="jquery.signalR.core.js" />
(function ($) {
$.signalR.version = "1.1.2";
$.signalR.version = "1.1.3";
}(window.jQuery));

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.1.8 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* @license RequireJS 2.1.8+ Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
*/
@ -12,7 +12,7 @@ var requirejs, require, define;
(function (global) {
var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath,
version = '2.1.8',
version = '2.1.8+',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/,
@ -1609,7 +1609,7 @@ var requirejs, require, define;
//Join the path parts together, then figure out if baseUrl is needed.
url = syms.join('/');
url += (ext || (/\?/.test(url) || skipExt ? '' : '.js'));
url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js'));
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
}