mirror of
https://github.com/Kong/insomnia.git
synced 2026-10-27 00:59:18 -04:00
* Playing around with pre-request hooks * Added response hooks * More flow types * Flow types on wrapper.js * Flow types on plugin folder * Basic tests for plugin hooks * Make DB initilize for all tests no matter what * Touch
23 lines
628 B
JavaScript
23 lines
628 B
JavaScript
// @flow
|
|
import type {Plugin} from '../';
|
|
import * as electron from 'electron';
|
|
import {showAlert} from '../../ui/components/modals/index';
|
|
|
|
export function init (plugin: Plugin): {app: Object} {
|
|
return {
|
|
app: {
|
|
alert (message: string): Promise<void> {
|
|
return showAlert({title: `Plugin ${plugin.name}`, message: message || ''});
|
|
},
|
|
getPath (name: string): string {
|
|
switch (name.toLowerCase()) {
|
|
case 'desktop':
|
|
return electron.remote.app.getPath('desktop');
|
|
default:
|
|
throw new Error(`Unknown path name ${name}`);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
}
|