Pyloid Docs
GithubLanguage
  • 💎What is Pyloid?
  • Getting Started
    • Prerequisites
    • Create Pyloid App
  • Core Concepts
    • Thread Safety
  • API
    • Python (Backend)
      • Pyloid
      • BrowserWindow
      • Monitor
      • TrayEvent
      • Utility Functions
      • RPC
      • Store
    • Javascript (Frontend)
      • Event
      • BaseAPI
      • RPC
  • Guides
    • Load Webview
    • Serve Frontend
    • Calling Python from JS
    • Calling JS from Python
    • Keyboard Shotcuts
    • Notification
    • Tray
    • Timer
    • File Watcher
    • Clipboard
    • Window Position
    • Devtools
    • Window Drag Region
    • Window Radius And Transparent
    • Autostart
    • Production Utils
    • Desktop Monitor
    • File Dialog
    • Splash Screen
Powered by GitBook
On this page
  • Python Backend
  • JavaScript Frontend

Was this helpful?

Edit on GitHub
  1. API
  2. Javascript (Frontend)

Event

This can invoke events from Python to JavaScript.

Python Backend

In Python, you can use specific libraries to trigger events. For example, you can use the pyloid library to trigger events.

# Invoke the 'hello_event' event with a message
window.invoke('hello_event', {'message': 'Hello from Python!'})

JavaScript Frontend

In JavaScript, you can receive and handle events triggered from Python. You can use the pyloid-js library to receive events.

import { event } from 'pyloid-js';

// Register the event listener
event.listen('hello_event', (data) => {
    console.log('hello_event', data.message);
});

// Unregister the event listener
event.unlisten('hello_event');
PreviousJavascript (Frontend)NextBaseAPI

Last updated 29 days ago

Was this helpful?