Index: lib/utils.js |
=================================================================== |
--- a/lib/utils.js |
+++ b/lib/utils.js |
@@ -10,54 +10,55 @@ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
-var Utils = exports.Utils = { |
+"use strict"; |
+ |
+let Utils = { |
systemPrincipal: null, |
- getString: function(id) |
+ getString(id) |
{ |
return id; |
}, |
- runAsync: function(callback, thisPtr) |
+ runAsync(callback, thisPtr, ...params) |
{ |
- var params = Array.prototype.slice.call(arguments, 2); |
- window.setTimeout(function() |
+ setTimeout(() => |
{ |
callback.apply(thisPtr, params); |
}, 0); |
}, |
get appLocale() |
{ |
return _appInfo.locale; |
}, |
- generateChecksum: function(lines) |
+ generateChecksum(lines) |
{ |
// We cannot calculate MD5 checksums yet :-( |
return null; |
}, |
- checkLocalePrefixMatch: function(prefixes) |
+ checkLocalePrefixMatch(prefixes) |
{ |
if (!prefixes) |
return null; |
let list = prefixes.split(","); |
for (let prefix of list) |
if (new RegExp("^" + prefix + "\\b").test(this.appLocale)) |
return prefix; |
return null; |
}, |
- chooseFilterSubscription: function(subscriptions) |
+ chooseFilterSubscription(subscriptions) |
{ |
let selectedItem = null; |
let selectedPrefix = null; |
let matchCount = 0; |
for (let i = 0; i < subscriptions.length; i++) |
{ |
let subscription = subscriptions[i]; |
if (!selectedItem) |
@@ -86,8 +87,10 @@ |
selectedPrefix = prefix; |
} |
} |
} |
} |
return selectedItem; |
} |
}; |
+ |
+exports.Utils = Utils; |