Qix-/color

Remove Freeze #175

ferllings posted onGitHub

Hello,

Is it possible to remove or bypass

Object.freeze(this);

I would like to extend the object to add additional properties.

Idealy I would like to extend the object using this. but it doesn't seems to work.

function MyClass() {
  Color.call(this);
}

// inherit one class
MyClass.prototype = Object.create(Color.prototype);
// mixin another
Object.assign(MyClass.prototype, {
  //... you own prototype ...
});

// re-assign constructor
MyClass.prototype.constructor = MyClass;

No, sorry. This was a huge improvement over the previous API; the mutability of color objects were causing headaches for a lot of people.

You should instead write a wrapper class instead of extending Color. :)

posted by Qix- about 5 years ago

Fund this Issue

$0.00
Funded

Pull requests