mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 19:26:33 +00:00
Rename setProgress to setProgressState
It shows the intention more clearly now that the function not only accepts a plain percentage.
This commit is contained in:
parent
a46a716512
commit
d9641fc557
@ -355,7 +355,7 @@ imageWriter.service('ImageWriterService', function($q, $timeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Set progress percentage
|
* @summary Set progress state
|
||||||
* @function
|
* @function
|
||||||
* @private
|
* @private
|
||||||
*
|
*
|
||||||
@ -363,11 +363,11 @@ imageWriter.service('ImageWriterService', function($q, $timeout) {
|
|||||||
* @param {Number} state.percentage - progress percentage
|
* @param {Number} state.percentage - progress percentage
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ImageWriterService.setProgress({
|
* ImageWriterService.setProgressState({
|
||||||
* percentage: 50
|
* percentage: 50
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
this.setProgress = function(state) {
|
this.setProgressState = function(state) {
|
||||||
|
|
||||||
// Safely bring the state to the world of Angular
|
// Safely bring the state to the world of Angular
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
@ -386,7 +386,7 @@ imageWriter.service('ImageWriterService', function($q, $timeout) {
|
|||||||
* ImageWriterService.reset();
|
* ImageWriterService.reset();
|
||||||
*/
|
*/
|
||||||
this.reset = function() {
|
this.reset = function() {
|
||||||
self.setProgress({
|
self.setProgressState({
|
||||||
percentage: 0
|
percentage: 0
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -475,7 +475,7 @@ imageWriter.service('ImageWriterService', function($q, $timeout) {
|
|||||||
|
|
||||||
self.setBurning(true);
|
self.setBurning(true);
|
||||||
|
|
||||||
return self.performWrite(image, drive, self.setProgress).finally(function() {
|
return self.performWrite(image, drive, self.setProgressState).finally(function() {
|
||||||
self.setBurning(false);
|
self.setBurning(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -47,7 +47,7 @@ imageWriter.service('ImageWriterService', function($q, $timeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Set progress percentage
|
* @summary Set progress state
|
||||||
* @function
|
* @function
|
||||||
* @private
|
* @private
|
||||||
*
|
*
|
||||||
@ -55,11 +55,11 @@ imageWriter.service('ImageWriterService', function($q, $timeout) {
|
|||||||
* @param {Number} state.percentage - progress percentage
|
* @param {Number} state.percentage - progress percentage
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ImageWriterService.setProgress({
|
* ImageWriterService.setProgressState({
|
||||||
* percentage: 50
|
* percentage: 50
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
this.setProgress = function(state) {
|
this.setProgressState = function(state) {
|
||||||
|
|
||||||
// Safely bring the state to the world of Angular
|
// Safely bring the state to the world of Angular
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
@ -78,7 +78,7 @@ imageWriter.service('ImageWriterService', function($q, $timeout) {
|
|||||||
* ImageWriterService.reset();
|
* ImageWriterService.reset();
|
||||||
*/
|
*/
|
||||||
this.reset = function() {
|
this.reset = function() {
|
||||||
self.setProgress({
|
self.setProgressState({
|
||||||
percentage: 0
|
percentage: 0
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -167,7 +167,7 @@ imageWriter.service('ImageWriterService', function($q, $timeout) {
|
|||||||
|
|
||||||
self.setBurning(true);
|
self.setBurning(true);
|
||||||
|
|
||||||
return self.performWrite(image, drive, self.setProgress).finally(function() {
|
return self.performWrite(image, drive, self.setProgressState).finally(function() {
|
||||||
self.setBurning(false);
|
self.setBurning(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -61,10 +61,10 @@ describe('Browser: ImageWriter', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('.setProgress()', function() {
|
describe('.setProgressState()', function() {
|
||||||
|
|
||||||
it('should be able to set the progress', function() {
|
it('should be able to set the progress', function() {
|
||||||
ImageWriterService.setProgress({
|
ImageWriterService.setProgressState({
|
||||||
percentage: 50
|
percentage: 50
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ describe('Browser: ImageWriter', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should floor the percentage', function() {
|
it('should floor the percentage', function() {
|
||||||
ImageWriterService.setProgress({
|
ImageWriterService.setProgressState({
|
||||||
percentage: 49.9999
|
percentage: 49.9999
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ describe('Browser: ImageWriter', function() {
|
|||||||
describe('.reset()', function() {
|
describe('.reset()', function() {
|
||||||
|
|
||||||
it('should reset progress percentage to 0', function() {
|
it('should reset progress percentage to 0', function() {
|
||||||
ImageWriterService.setProgress({
|
ImageWriterService.setProgressState({
|
||||||
percentage: 50
|
percentage: 50
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user