NAME

Chandra::Bridge - JavaScript bridge code for Perl communication

SYNOPSIS

use Chandra::Bridge;

# Get the JS code to inject
my $js = Chandra::Bridge->js_code;

# Inject into webview
$app->eval_js($js);

DESCRIPTION

This module contains the JavaScript bridge code that enables communication between JavaScript and Perl via window.chandra.

JavaScript API

After injection, the following is available in JavaScript:

// Call a Perl function (returns Promise)
const result = await window.chandra.invoke('method_name', [arg1, arg2]);

// Shorthand
const result = await window.chandra.call('method_name', arg1, arg2);