New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kitware/trame-iframe

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kitware/trame-iframe

This library aims to simplify interaction between a trame application living inside an iframe and its iframe parent. This work is inspired by the [official trame-client js lib](https://github.com/Kitware/trame-client/tree/master/js-lib)

1.1.1
latest
Source
npm
Version published
Weekly downloads
1
-50%
Maintainers
0
Weekly downloads
 
Created
Source

Trame iframe library for plain JS

This library aims to simplify interaction between a trame application living inside an iframe and its iframe parent.
This work is inspired by the official trame-client js lib

Examples

  • Vite

Usage

First you need to grab the iframe that contains your trame application.

import ClientCommunicator from "@kitware/trame-iframe";

const iframe = document.getElementById("trame_app");
const iframe_url = "http://localhost:3000";

const trame = new ClientCommunicator(iframe, iframe_url);

// set
trame.state.set("a", 2);
trame.state.set('b', 3);
trame.state.update({
    a: 2.5,
    b: 3.5,
    c: 4.5,
})

// get
console.log(trame.state.get("c"));
console.log(trame.state.get('a'));


// simple api for state change
trame.state.watch(
    ["a", "b", "c"], 
    (a, b, c) => {
        console.log(`a(${a}) or b(${b}) or c(${c}) have changed`);
    }
);

// -----------------------------------
// Method execution API
// -----------------------------------

// method execution on Python side
trame.trigger("name", ['arg_0', 'arg_1'], { kwarg_0: 1,  kwarg_1: 2 });

FAQs

Package last updated on 13 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts