Skip to content
Compare
Choose a tag to compare
@github-actions github-actions released this 01 Apr 18:55
· 187 commits to main since this release
6a55c1e

Patch Changes

  • Add experimental invoke API to call Python functions from the front end and (#453)
    await the response.

    This removes a lot of boilerplate required for this pattern. The API is
    experimental and opt-in only. Subclasses must use the command to register
    functions.

    class Widget(anywidget.AnyWidget):
        _esm = """
        export default {
          async render({ model, el, experimental }) {
            let [msg, buffers] = await experimental.invoke("_echo", "hello, world");
            console.log(msg); // "HELLO, WORLD"
          },
        };
        """
    
        @anywidget.experimental.command
        def _echo(self, msg, buffers):
            # upper case the message
            return msg.upper(), buffers
  • Updated dependencies [777fc268ee06fcf13e48a1c00cfdf90c14d786dc]: