Skip to content

Conversation

@iqbaleff214
Copy link
Member

@iqbaleff214 iqbaleff214 commented Mar 17, 2025

resolve #14.

image image image image

})
fileMenu.AddSeparator()
fileMenu.AddText("Save", keys.CmdOrCtrl("s"), func(_ *menu.CallbackData) {
runtime.EventsEmit(m.ctx, "menu:save")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kode runtime.EventsEmit(m.ctx, "...") ini ngirim event ke FE, nanti tinggal listen aja pakai window?.runtime?.EventsOn("...", callback)

<script>
    import {WriteFile} from "../wailsjs/go/filesystem/FileManager";
    import {MessageInfoDialog} from "../wailsjs/go/filesystem/Dialog";
    
    let currentActiveFilePath = $state('');
    let obfuscated = $state('');

    const saveFile = (path) => {
        WriteFile(path, obfuscated).then(() => {
            // do something if success
        }).catch((error: any) => {
            MessageInfoDialog('Error', error);
        });
    };

    onMount(() => {
        window?.runtime?.EventsOn("menu:save", () => saveFile(currentActiveFilePath));
    });
</script>

Copy link
Member Author

@iqbaleff214 iqbaleff214 Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kalau sudah merge tolong dibantu tambahin di sveltenya ya, bung @andikasujanadi, di hampir semua menu ada event emitnya

@iqbaleff214 iqbaleff214 self-assigned this Mar 17, 2025
@iqbaleff214 iqbaleff214 merged commit f860810 into develop Mar 18, 2025
1 check passed
@iqbaleff214 iqbaleff214 deleted the feature/14-menu branch March 18, 2025 06:28
@andikasujanadi
Copy link
Contributor

takut gwej @iqbaleff214

@iqbaleff214
Copy link
Member Author

sudah aku bantu update buat branch ui_improvement, @andikasujanadi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants