summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-03-24 18:27:01 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-03-24 18:27:01 +0000
commit236bb933292e53d5b9263e5b86c8b012fa0dc8dc (patch)
tree055636391a620e9bd34e7b1b8515ed8a9b55287d
parent9f7c19b352b4a5753b9ff15a629ba85b2b38357f (diff)
downloadgitlab-ce-236bb933292e53d5b9263e5b86c8b012fa0dc8dc.tar.gz
Changes after review
-rw-r--r--app/assets/javascripts/lib/utils/poll.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/app/assets/javascripts/lib/utils/poll.js b/app/assets/javascripts/lib/utils/poll.js
index 1d86ec19454..4112f861b10 100644
--- a/app/assets/javascripts/lib/utils/poll.js
+++ b/app/assets/javascripts/lib/utils/poll.js
@@ -8,10 +8,10 @@ import httpStatusCodes from './http_status';
* new Poll({
* resource: resource,
* method: 'name',
- * data: {page: 1, scope: 'all'},
+ * data: {page: 1, scope: 'all'}, // optional
* successCallback: () => {},
* errorCallback: () => {},
- * auxiliarCallback: () => {},
+ * notificationCallback: () => {}, // optional
* }).makeRequest();
*
* Usage in pipelines table with visibility lib:
@@ -22,7 +22,7 @@ import httpStatusCodes from './http_status';
* data: { page: pageNumber, scope },
* successCallback: this.successCallback,
* errorCallback: this.errorCallback,
- * auxiliarCallback: this.updateLoading,
+ * notificationCallback: this.updateLoading,
* });
*
* if (!Visibility.hidden()) {
@@ -48,6 +48,8 @@ export default class Poll {
constructor(options = {}) {
this.options = options;
this.options.data = options.data || {};
+ this.options.notificationCallback = options.notificationCallback ||
+ function notificationCallback() {};
this.intervalHeader = 'POLL-INTERVAL';
this.timeoutID = null;
@@ -68,14 +70,14 @@ export default class Poll {
}
makeRequest() {
- const { resource, method, data, errorCallback, auxiliarCallback } = this.options;
+ const { resource, method, data, errorCallback, notificationCallback } = this.options;
// It's called everytime a new request is made. Useful to update the status.
- auxiliarCallback(true);
+ notificationCallback(true);
return resource[method](data)
- .then(response => this.checkConditions(response))
- .catch(error => errorCallback(error));
+ .then(response => this.checkConditions(response))
+ .catch(error => errorCallback(error));
}
/**