12345678910111213141516171819202122232425262728293031323334353637 |
- // 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: `
- <h2>compressImages</h2>
- <hr />
- <div>State: <span id="label">--</span></div>
- <hr />
- <ui-button id="btn">Send To Main</ui-button>
- `,
- // 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!';
- }
- }
- });
|