ruby.wasm icon indicating copy to clipboard operation
ruby.wasm copied to clipboard

JS::Object inherits BasicObject

Open ledsun opened this issue 1 year ago • 0 comments

The original motivation was to make it easier to call the JavaScript WebSocket#send method.

To achieve this, the following three methods were considered.

  1. Undefine the Object#send method
  2. Override the Object#send method
  3. Stop inheriting from the Object class

I was attracted by the fact that it clearly defines the role of the JS::Object class as a class that wraps JavaScript objects. I adopted the third method.

You can see past challenges at https://github.com/ruby/ruby.wasm/pull/509.

The following issues currently exist.

  • The definition of the respond_to? method, which is only used in tests, cannot be removed.

ledsun avatar Oct 19 '24 15:10 ledsun