// panel/index.js, this filename needs to match the one registered in package.json
Editor.Panel.extend({
// css style for panel
style: `
:host { margin: 5px; }
h2 { color: #f90; }
`,
// html template for panel
template: `
compressImages
State: --
Send To Main
`,
// element and variable binding
$: {
btn: '#btn',
label: '#label',
},
// method executed when template and styles are successfully loaded and initialized
ready () {
this.$btn.addEventListener('confirm', () => {
Editor.Ipc.sendToMain('compressImages:clicked');
});
},
// register your ipc messages here
messages: {
'compressImages:hello' (event) {
this.$label.innerText = 'Hello!';
}
}
});