Skip to content

Commit

Permalink
Colormaker is a class: it can't be called without new
Browse files Browse the repository at this point in the history
Previous implementation of Colormaker was probably relying
on JS prototypal inheritance.
Colormaker cannot be called like a function anymore.
  • Loading branch information
ppillot committed Nov 24, 2023
1 parent 25fbf4a commit 0899733
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/color/colormaker-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,13 @@ class ColormakerRegistry {
delete this.userSchemes[ id ]
}

_createScheme (constructor: any) {
const _Colormaker = function (this: any, params: ColormakerParameters) {
Colormaker.call(this, params)
constructor.call(this, params)
_createScheme (constructor: any): typeof Colormaker {
class _Colormaker extends Colormaker {
constructor (params: ColormakerParameters) {
super(params)
constructor.call(this, params)
}
}

_Colormaker.prototype = Colormaker.prototype
_Colormaker.prototype.constructor = Colormaker

return _Colormaker
}

Expand Down

0 comments on commit 0899733

Please sign in to comment.