Files
insomnia/app/plugins/context/app.js
T
Gregory Schier 09c219fb6d More Plugin Hooks (#352)
* 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
2017-07-19 18:55:40 -07:00

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}`);
}
}
}
};
}