Page MenuHomePhabricator

OOjs + ES6
Closed, ResolvedPublic

Description

OOjs provides class inheritance in ES5 environments. As we eventually move to an ES6 world, that part of the library will become redundant, but other parts may remain useful.

ES6 class inheritance works very similarly to OOjs's, and most features should continue to work out of the box (including the static property).

Mixins may need some work to continue being supported as classes, as OOjs assumes the class prototype is iterable, which it isn't in ES6. It may not make sense to keep defining mixins as classes, but a new standard that is supported by OO.mixinClass should be defined.

OOjs also contains other features:

  • Event emitters
  • Registries
  • Factories
  • Various utility methods for handling objects/arrays, some of which may eventually be redundant in later versions of ES

All these features should be tested with ES6 classes.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Krinkle triaged this task as Medium priority.Jun 14 2021, 6:24 PM

Change 789900 had a related patch set uploaded (by Krinkle; author: Krinkle):

[oojs/core@master] Factory: Support registering and creating objects from ES6 classes

https://gerrit.wikimedia.org/r/789900

Change 789900 merged by jenkins-bot:

[oojs/core@master] Factory: Support registering and creating objects from ES6 classes

https://gerrit.wikimedia.org/r/789900

Change 914019 had a related patch set uploaded (by Krinkle; author: Krinkle):

[oojs/core@master] build: Upgrade eslint-config-wikimedia from 0.24.0 to 0.25.0

https://gerrit.wikimedia.org/r/914019

Change 913963 had a related patch set uploaded (by Krinkle; author: Bartosz Dziewoński):

[oojs/core@master] core,Factory: Use ES6 Set and ES6 Reflect to optimise various methods

https://gerrit.wikimedia.org/r/913963

Change 914019 merged by jenkins-bot:

[oojs/core@master] build: Upgrade eslint-config-wikimedia from 0.24.0 to 0.25.0

https://gerrit.wikimedia.org/r/914019

Change 913963 merged by jenkins-bot:

[oojs/core@master] core,Factory: Use ES6 Set and ES6 syntax to optimise various methods

https://gerrit.wikimedia.org/r/913963

Krinkle claimed this task.
Krinkle removed a project: Patch-For-Review.

@Esanders I'm closing this based on its original scope being done, with adoption of ES6 classes unblocked by providing static.name in an ES6-compatible way. It's not yet adopted in OOUI/VE though, so if you uncover new issues if/when you do so, feel free to re-open or file a new task!

Change 917378 had a related patch set uploaded (by Krinkle; author: Krinkle):

[oojs/core@master] Release v7.0.0

https://gerrit.wikimedia.org/r/917378

Change 917378 merged by jenkins-bot:

[oojs/core@master] Release v7.0.0

https://gerrit.wikimedia.org/r/917378