Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a JS lib to support trame-client API through an iframe #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bourdaisj
Copy link

@bourdaisj bourdaisj commented Nov 13, 2024

uses: Kitware/trame-client#29 for state watchers API

similar to trame-client js-api, trame-iframe js-api provides an agnostic library
that can be installed in a regular JS project.
trame-iframe js-api could be installed in a host application (could be
react/streamlit/vue/... based) to proxy the trame API calls through the
iframe to the Communicator and the trame application.
The goal is to replicate the trame-client js-api features to make it
transparent to the consumer code.
API:
- trame.state.set
- trame.state.update
- trame.state.watch
- trame.trigger

This is still possible to directly interact with the Communicator from
an host application by manually sending/listening to events.
{
"name": "@kitware/trame-iframe-client",
"version": "0.0.5",
"license": "MIT",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why MIT instead of Apache?

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why MIT instead of Apache?

/**
* @returns promise function with a "resolve" attribute, so it can be resolved from outside the promise executor
*/
function promiseCreator() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe want to provide resolve and reject?

self._attributes["ref"] = f'ref="{self.__ref}"'
self._attributes["parent_origin"] = f'parentOrigin="{self._parent_origin}"'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to set _attributes if you add it to self._attr_names

Copy link
Collaborator

@jourdain jourdain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM at a high level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants