Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save u1735067/01611e017d874af51cb52ceefecc2d5d to your computer and use it in GitHub Desktop.
Save u1735067/01611e017d874af51cb52ceefecc2d5d to your computer and use it in GitHub Desktop.
From 34db8a351b8fc43362bcbf0cba9e186b2c3a1b80 Mon Sep 17 00:00:00 2001
From: "Alexandre L."
Date: Tue, 7 Jul 2015 19:25:22 +0200
Subject: [PATCH] Dirty workaround
---
exportify.js | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/exportify.js b/exportify.js
index fd54596..b8404f5 100644
--- a/exportify.js
+++ b/exportify.js
@@ -1,3 +1,11 @@
+function sleep(milliseconds) {
+ var start = new Date().getTime();
+ for (var i = 0; i < 1e7; i++) {
+ if ((new Date().getTime() - start) > milliseconds){
+ break;
+ }
+ }
+}
window.Helpers = {
authorize: function() {
var client_id = this.getQueryParam('app_client_id');
@@ -23,7 +31,7 @@ window.Helpers = {
},
apiCall: function(url, access_token) {
- return $.ajax({
+ result = $.ajax({
url: url,
headers: {
'Authorization': 'Bearer ' + access_token
@@ -39,7 +47,9 @@ window.Helpers = {
// Otherwise report the error so user can raise an issue
alert(jqXHR.responseText);
}
- })
+ });
+ sleep(500);
+ return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment