Opened 3 years ago

Closed 2 years ago

#4801 closed change (duplicate)

Use modern JavaScript syntax throughout adblockplusui

Reported by: kzar Assignee:
Priority: Unknown Milestone:
Module: User-Interface Keywords:
Cc: sebastian, greiner Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description

Background

With the messageResponder.js changes #4783 we updated that file to use more modern JavaScript syntax. We're also updating the syntax used throughout the adblockpluschrome repository #4795. For consistency we should do the same with the rest of the adblockplusui code.

What to change

Where possible:

  • Replace anonymous functions with arrow functions.
  • Replace var variable definitions with let ones.
  • Replace for i = 0; i < whatever.length with for ... of whatever.
  • Ensure method definitions use the new syntax. (E.g. {foo: function(bar) { }} becomes {foo(bar) { }}.
  • Replace IIFEs with a simple block. (E.g. (function(global) { ... })(window) becomes { ... }.
  • Ensure that "use strict"; is used throughout.

Change History (1)

comment:1 Changed 2 years ago by greiner

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #4871

Note: See TracTickets for help on using tickets.