Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
HTTP запросы без CORS через main процесс Electron
await api.HTTP.get(url, headers?) await api.HTTP.post(url, body, headers?) await api.HTTP.put(url, body, headers?) await api.HTTP.del(url, headers?) await api.HTTP.request({ url, method, headers, body, timeout })
{ ok: boolean, // true если status 200–299 status: number, headers: object, data: any, // JSON если парсится, иначе string }
{ ok: false, status: 0, error: string }
url
method
'GET'
headers
{}
body
timeout
15000
const res = await api.HTTP.get('https://api.example.com/data'); if (res.ok) api.Logger.log(res.data);
const res = await api.HTTP.post( 'https://api.example.com/track', { artist: 'Imagine Dragons', title: 'Bones' } );
const res = await api.HTTP.get( 'https://api.example.com/me', { Authorization: 'Bearer ' + api.Storage.get('token') } ); if (!res.ok) api.Logger.warn('Ошибка:', res.status);