mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-07 05:59:02 +00:00
add api.electron to access __enhancerElectronApi
This commit is contained in:
parent
39f66c5bb8
commit
7abbb779f5
48
api/client/electron.mjs
Normal file
48
api/client/electron.mjs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* notion-enhancer core: api
|
||||||
|
* (c) 2021 dragonwocky <thedragonring.bod@gmail.com> (https://dragonwocky.me/)
|
||||||
|
* (https://notion-enhancer.github.io/) under the MIT license
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* access to electron renderer apis
|
||||||
|
* @module notion-enhancer/api/env
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* access to the electron BrowserWindow instance for the current window
|
||||||
|
* see https://www.electronjs.org/docs/latest/api/browser-window
|
||||||
|
* @type {BrowserWindow}
|
||||||
|
*/
|
||||||
|
export const browser = window.__enhancerElectronApi?.browser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* access to the electron webFrame instance for the current page
|
||||||
|
* see https://www.electronjs.org/docs/latest/api/web-frame
|
||||||
|
* @type {webFrame}
|
||||||
|
*/
|
||||||
|
export const webFrame = window.__enhancerElectronApi?.webFrame;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* send a message to the main electron process
|
||||||
|
* @param {string} channel - the message identifier
|
||||||
|
* @param {any} data - the data to pass along with the message
|
||||||
|
*/
|
||||||
|
export const sendMessage = window.__enhancerElectronApi?.sendMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* send a message to the webview's parent renderer process
|
||||||
|
* @param {string} channel - the message identifier
|
||||||
|
* @param {any} data - the data to pass along with the message
|
||||||
|
*/
|
||||||
|
export const sendMessageToHost = window.__enhancerElectronApi?.sendMessageToHost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* receive a message from either the main process or
|
||||||
|
* the webview's parent renderer process
|
||||||
|
* @param {string} channel - the message identifier to listen for
|
||||||
|
* @param {function} listener - the message handler, passed the args (event, data)
|
||||||
|
*/
|
||||||
|
export const onMessage = window.__enhancerElectronApi?.onMessage;
|
@ -15,6 +15,9 @@ export * as fs from './client/fs.mjs';
|
|||||||
/** environment-specific data persistence */
|
/** environment-specific data persistence */
|
||||||
export * as storage from './client/storage.mjs';
|
export * as storage from './client/storage.mjs';
|
||||||
|
|
||||||
|
/** access to electron renderer apis */
|
||||||
|
export * as electron from './client/electron.mjs';
|
||||||
|
|
||||||
/** a basic wrapper around notion's unofficial api */
|
/** a basic wrapper around notion's unofficial api */
|
||||||
export * as notion from './client/notion.mjs';
|
export * as notion from './client/notion.mjs';
|
||||||
/** helpers for formatting, validating and parsing values */
|
/** helpers for formatting, validating and parsing values */
|
||||||
|
Loading…
Reference in New Issue
Block a user