Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ca5982af
Commit
ca5982af
authored
Mar 21, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes after review - receives service and method to match current architecture
parent
557c5b0d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
app/assets/javascripts/lib/utils/poll.js
app/assets/javascripts/lib/utils/poll.js
+14
-9
No files found.
app/assets/javascripts/lib/utils/poll.js
View file @
ca5982af
import
Vue
from
'
vue
'
;
import
VueResource
from
'
vue-resource
'
;
import
httpStatusCodes
from
'
./http_status
'
;
import
httpStatusCodes
from
'
./http_status
'
;
Vue
.
use
(
VueResource
);
/**
/**
* Polling utility for handling realtime updates with Vue.Resource get method.
* Polling utility for handling realtime updates.
* Service for vue resouce and method need to be provided as props
*
*
* @example
* @example
* new poll({
* new poll({
* url: 'endopoint',
* resource: resource,
* data: {},
* method: 'name',
* successCallback: () => {},
* errorCallback: () => {},
* }).makeRequest();
*
* this.service = new BoardsService(endpoint);
* new poll({
* resource: this.service,
* method: 'get',
* successCallback: () => {},
* successCallback: () => {},
* errorCallback: () => {},
* errorCallback: () => {},
* }).makeRequest();
* }).makeRequest();
...
@@ -47,8 +52,8 @@ export default class poll {
...
@@ -47,8 +52,8 @@ export default class poll {
}
}
makeRequest
()
{
makeRequest
()
{
return
Vue
.
http
.
get
(
this
.
options
.
url
,
this
.
options
.
data
)
return
this
.
options
.
resource
[
this
.
options
.
method
](
)
.
then
(
this
.
checkConditions
)
.
then
(
this
.
checkConditions
.
bind
(
this
)
)
.
catch
(
error
=>
this
.
options
.
errorCallback
(
error
));
.
catch
(
error
=>
this
.
options
.
errorCallback
(
error
));
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment