Skip to content

Instantly share code, notes, and snippets.

@RahulDas-dev
Last active December 3, 2021 08:04
Show Gist options
  • Save RahulDas-dev/ae0fce38a2c51f5ef6800a3876dc3974 to your computer and use it in GitHub Desktop.
Save RahulDas-dev/ae0fce38a2c51f5ef6800a3876dc3974 to your computer and use it in GitHub Desktop.
How To trigger commands from Frontend to change the state object
private registerListeners() {
appWindow.listen('config-init', event => {
console.log('registerListeners :', event.payload, event.event)
})
appWindow.listen('page-loaded', event => {
//console.log('page-loaded :', event.payload, event.event)
appWindow.show()
})
appWindow.once('tauri://close-requested', this.window_close_handeler)
appWindow.once('tauri://destroyed', this.window_close_handeler)
appWindow.listen('tauri://resize', ({ event, payload }) => {
console.log('resize event trigered :', payload, event)
const { width, height } = payload as PhysicalSize
invoke('plugin:config|change_dimension', { height: height, width: width })
})
appWindow.listen('tauri://move', ({ event, payload }) => {
const { x, y } = payload as PhysicalPosition
console.log('Move event trigered :', x, y)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment