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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
970386e6
Commit
970386e6
authored
Nov 02, 2017
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
review feedback - throw error in smart_callback catch block
parent
17f2ba7f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
app/assets/javascripts/smart_interval.js
app/assets/javascripts/smart_interval.js
+3
-2
spec/javascripts/smart_interval_spec.js
spec/javascripts/smart_interval_spec.js
+9
-6
No files found.
app/assets/javascripts/smart_interval.js
View file @
970386e6
...
...
@@ -5,7 +5,7 @@
export
default
class
SmartInterval
{
/**
* @param { function } opts.callback
A Promise, called on each iteration (required) unless still in progress
* @param { function } opts.callback
Function that returns a promise, called on each iteration unless still in progress (required)
* @param { milliseconds } opts.startingInterval `currentInterval` is set to this initially
* @param { milliseconds } opts.maxInterval `currentInterval` will be incremented to this
* @param { milliseconds } opts.hiddenInterval `currentInterval` is set to this
...
...
@@ -113,8 +113,9 @@ export default class SmartInterval {
.
then
(()
=>
{
this
.
isLoading
=
false
;
})
.
catch
(()
=>
{
.
catch
((
err
)
=>
{
this
.
isLoading
=
false
;
throw
new
Error
(
err
);
});
}
...
...
spec/javascripts/smart_interval_spec.js
View file @
970386e6
...
...
@@ -58,16 +58,19 @@ describe('SmartInterval', function () {
},
DEFAULT_LONG_TIMEOUT
);
});
it
(
'
does not increment while waiting for callback
'
,
function
(
done
)
{
it
(
'
does not increment while waiting for callback
'
,
function
()
{
jasmine
.
clock
().
install
();
const
smartInterval
=
createDefaultSmartInterval
({
callback
:
()
=>
new
Promise
(
$
.
noop
),
});
setTimeout
(()
=>
{
const
oneInterval
=
smartInterval
.
cfg
.
startingInterval
*
DEFAULT_INCREMENT_FACTOR
;
expect
(
smartInterval
.
getCurrentInterval
()).
toEqual
(
oneInterval
);
done
();
},
DEFAULT_SHORT_TIMEOUT
);
jasmine
.
clock
().
tick
(
DEFAULT_SHORT_TIMEOUT
);
const
oneInterval
=
smartInterval
.
cfg
.
startingInterval
*
DEFAULT_INCREMENT_FACTOR
;
expect
(
smartInterval
.
getCurrentInterval
()).
toEqual
(
oneInterval
);
jasmine
.
clock
().
uninstall
();
});
});
...
...
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