Search Results

Search found 1 results on 1 pages for 'kwicher'.

Page 1/1 | 1 

  • Redefine Object.defineProperty in Javascript

    - by kwicher
    I would like to learn if it is possible to redefine the "definePropery" function of the Object(.prototype) in a subclass(.prototype) so that the setter not only sets the value of the property but also eg executes an additional method. I have tried something like that: Myclass.prototype.defineProperty = function (obj, prop, meth) { Object.defineProperty.call(this, obj, prop, { get: function () { return obj[prop] }, set: function () { obj[prop] = n; alert("dev") } }) } But id does not work

    Read the article

1