0

I need to override a buggy library for a specific browser, but I can't just remove it since it "works" for all the other browsers.

I was trying to accomplish something of the following (like Ruby sending messages to methods):

  • override the libraries object:

    var lib = {}

  • override any call to this empty object to answer as if I was invoking this code:

    lib.xxx = function(){}

is it even possible to do in Javascript?

Draconar
  • 1,147
  • 1
  • 17
  • 36
  • Not yet. ES6 introduces proxies which can intercept any property access (also to non-existing properties). – Felix Kling Aug 08 '14 at 19:04
  • firefox alone (afaik) has https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/noSuchMethod – dandavis Aug 08 '14 at 19:05

0 Answers0