Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8139266

add JSAdapter example with fallthrough

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 9
    • 9
    • core-libs
    • None

        Scenario: provide some extensions to a Java object with a JSAdapter, but have all (other) method calls fall through to the original object to provide transparent adaption.

        The following implementation of __call__ facilitates this. Add an example that illustrates it. Verify it works for multiple arguments.

        __call__: function() {
            var args = [x].concat(Array.prototype.slice.call(arguments, 1))
            return Function.call.apply(x[arguments[0]], args)
        }

              mhaupt Michael Haupt
              mhaupt Michael Haupt
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: