Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 5560bc2

Browse files
committed
changes after review
1 parent 4729958 commit 5560bc2

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

src/extensibility/ExtensionManager.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,10 @@ define(function (require, exports, module) {
525525

526526
/**
527527
* Gets an array of extensions that are currently installed and can be updated to a new version
528-
* @return {Array} array of objects with properies id,installVersion,registryVersion
529-
* where id = extensionId
530-
* installVersion = currently installed version of extension
531-
* registryVersion = latest version compatible with current Brackets
528+
* @return {Array.<{id: string, installVersion: string, registryVersion: string}>}
529+
* where id = extensionId
530+
* installVersion = currently installed version of extension
531+
* registryVersion = latest version compatible with current Brackets
532532
*/
533533
function getAvailableUpdates() {
534534
var result = [];
@@ -550,12 +550,14 @@ define(function (require, exports, module) {
550550
}
551551

552552
/**
553-
* Takes array returned from getAvailableUpdates() as an input and removes those entries
553+
* Takes the array returned from getAvailableUpdates() as an input and removes those entries
554554
* that are no longer current - when currently installed version of an extension
555555
* is equal or newer than registryVersion returned by getAvailableUpdates().
556556
* This function is designed to work without the necessity to download extension registry
557-
* @param {Array} previous output of getAvailableUpdates()
558-
* @param {Array} filtered input as function description
557+
* @param {Array.<{id: string, installVersion: string, registryVersion: string}>} updates
558+
* previous output of getAvailableUpdates()
559+
* @return {Array.<{id: string, installVersion: string, registryVersion: string}>}
560+
* filtered input as function description
559561
*/
560562
function cleanAvailableUpdates(updates) {
561563
return updates.reduce(function (arr, updateInfo) {

src/extensibility/ExtensionManagerViewModel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,8 @@ define(function (require, exports, module) {
424424

425425
var metadata1 = self.extensions[key1].installInfo.metadata,
426426
metadata2 = self.extensions[key2].installInfo.metadata,
427-
id1 = (metadata1.title || metadata1.name).toLowerCase(),
428-
id2 = (metadata2.title || metadata2.name).toLowerCase();
427+
id1 = (metadata1.title || metadata1.name).toLocaleLowerCase(),
428+
id2 = (metadata2.title || metadata2.name).toLocaleLowerCase();
429429

430430
return id1.localeCompare(id2);
431431
});

src/utils/UpdateNotification.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ define(function (require, exports, module) {
4242
UpdateDialogTemplate = require("text!htmlContent/update-dialog.html"),
4343
UpdateListTemplate = require("text!htmlContent/update-list.html");
4444

45+
// duration of one day in milliseconds
4546
var ONE_DAY = 1000 * 60 * 60 * 24;
4647

48+
// duration of two minutes in milliseconds
49+
var TWO_MINUTES = 1000 * 60 * 2;
50+
4751
// Extract current build number from package.json version field 0.0.0-0
4852
var _buildNumber = Number(/-([0-9]+)/.exec(brackets.metadata.version)[1]);
4953

@@ -250,11 +254,11 @@ define(function (require, exports, module) {
250254
// downloadRegistry, will be resolved in _onRegistryDownloaded
251255
ExtensionManager.downloadRegistry().done(function () {
252256
// schedule another check in 24 hours + 2 minutes
253-
setTimeout(checkForExtensionsUpdate, ONE_DAY + (2 * 60 * 1000));
257+
setTimeout(checkForExtensionsUpdate, ONE_DAY + TWO_MINUTES);
254258
});
255259
} else {
256260
// schedule the download of the registry in appropriate time
257-
setTimeout(checkForExtensionsUpdate, (timeOfNextCheck - currentTime) + (2 * 60 * 1000));
261+
setTimeout(checkForExtensionsUpdate, (timeOfNextCheck - currentTime) + TWO_MINUTES);
258262
}
259263
}
260264
}
@@ -383,7 +387,7 @@ define(function (require, exports, module) {
383387
// launch immediately and then every 24 hours + 2 minutes
384388
checkForUpdate();
385389
checkForExtensionsUpdate();
386-
window.setInterval(checkForUpdate, ONE_DAY + (2 * 60 * 1000));
390+
window.setInterval(checkForUpdate, ONE_DAY + TWO_MINUTES);
387391
}
388392

389393
// Append locale to version info URL

0 commit comments

Comments
 (0)