Skip to content

Remove unused utility functions #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions src/sa_web/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,6 @@ var Shareabouts = Shareabouts || {};
'use strict';

S.Util = {
patch: function(obj, overrides, func) {
var attr, originals = {};

// Switch out for the override values, but save the originals
for (attr in overrides) {
originals[attr] = obj[attr];
obj[attr] = overrides[attr];
}

// Run the function with the now patched object
func();

// Restore the original values
for (attr in originals) {
obj[attr] = originals[attr];
}
},

setPrettyDateLang: function(locale) {
moment.lang(locale);
},

getPrettyDateTime: function(datetime, format) {
if (format) {
return moment(datetime).format(format);
Expand Down Expand Up @@ -323,33 +301,6 @@ var Shareabouts = Shareabouts || {};
return newHandler;
},

callWithRetries: function(func, retryCount, context) {
var args = Array.prototype.slice.call(arguments, 3),
options = _.last(args),
errorHandler = options.error,
retries = 0;

if (!options) {
options = {};
args.push(options);
}

options.error = function() {
if (retries < retryCount) {
retries++;
setTimeout(function() {
func.apply(context, args);
}, retries * 100);
} else {
if (errorHandler) {
errorHandler.apply(context, arguments);
}
}
};

func.apply(context, args);
},

// Cookies! Om nom nom
// Thanks ppk! http://www.quirksmode.org/js/cookies.html
cookies: {
Expand Down