Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 833 Bytes

README.md

File metadata and controls

47 lines (33 loc) · 833 Bytes

electron-router

LICENSE npm (scoped)

Communicate asynchronously from the main process to renderer processes it's that simple!

Install

yarn add @cyyjs/electron-router

Usage

Main

const router = require('@cyyjs/electron-router')

router.get('list', async (query) => {
  return {
    err: '',
    data: {
      a: 1
    }
  }
})

router.post('save', async(data) => {})
router.put('update', async(data) => {})
router.delete('remove', async(id) => {})

Render

const api = require('@cyyjs/electron-router')

let { err, data } = await api.get('list', query)
// data: { a: 1 }

await api.post('save', {})
await api.put('update', {})
await api.delete('remove', id)