Page MenuHomePhabricator

Allow explicit naming of constructors in OO.Factory
Closed, ResolvedPublic

Description

oo.Factory.prototype.register( constructor ) requires the function given in constructor to have a "static" name property. I see no real necessity for this restriction. Instead an optional name parameter should be added to register which will be used instead of the static name if provided.

Without this the oo.Factory "class" can be quite useless when we want to register it with 3rd party constructors not following oojs conventions or if we have two factories where we want to register the same constructor for different purposes under different names.

See also:

Event Timeline

Danwe created this task.Jul 31 2015, 10:44 PM
Danwe raised the priority of this task from to Needs Triage.
Danwe updated the task description. (Show Details)
Danwe added a project: OOjs.
Danwe added a subscriber: Danwe.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 31 2015, 10:44 PM
Krinkle moved this task from Inbox to Accepted Enhancement on the OOjs board.Feb 12 2016, 5:25 PM
Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptFeb 12 2016, 5:25 PM
Krinkle triaged this task as Medium priority.May 8 2017, 12:40 AM
Krinkle updated the task description. (Show Details)May 11 2017, 11:17 PM
Krinkle renamed this task from oo.Factory: static name requirement seems unnecessary and inflexible to Allow explicit naming of constructors in OO.Factory.Apr 5 2019, 5:34 PM
Krinkle claimed this task.
Krinkle moved this task from Accepted Enhancement to Done on the OOjs board.

Change 501647 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[oojs/core@master] Factory: Support registration by name

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

Krinkle lowered the priority of this task from Medium to Low.Apr 6 2019, 11:39 PM

Change 501647 merged by jenkins-bot:
[oojs/core@master] Factory: Support registration by name

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

Krinkle closed this task as Resolved.Apr 9 2019, 12:31 AM
Krinkle edited projects, added Performance-Team; removed Patch-For-Review.
Krinkle moved this task from Done to Accepted Enhancement on the OOjs board.Aug 14 2020, 1:48 PM