nativephp.com icon indicating copy to clipboard operation
nativephp.com copied to clipboard

Docs broadcasting not working example

Open pkristian opened this issue 1 month ago • 0 comments

Discovered not working code example:

https://nativephp.com/docs/desktop/2/digging-deeper/broadcasting#listening-with-javascript

example provided:

window.addEventListener('native:init', () => {
 
    Native.on('Native\\Desktop\\Events\\Windows\\WindowBlurred', (payload, event) => {
        //
    })
 
    //
})

Following steps to reproduce:

in foo.blade.php: @vite(['resources/js/app.js'])

test code in app.js:

console.info('Blur Test!');

Native.on('Native\\Desktop\\Events\\Windows\\WindowBlurred', (payload, event) => {
    console.info('work!');
});

window.addEventListener('native:init', () => {
    Native.on('Native\\Desktop\\Events\\Windows\\WindowBlurred', (payload, event) => {
        console.info('does not work!');
    })
})

console output: Image

version: nativephp/desktop: "2.0.2"

pkristian avatar Nov 29 '25 19:11 pkristian