mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 19:25:35 -05:00
Prepared for the first publish (#1620)
This commit is contained in:
committed by
GitHub
parent
8a01a56e51
commit
c96f5912df
28
pyscript.next/types/core.d.ts
vendored
Normal file
28
pyscript.next/types/core.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* A `Worker` facade able to bootstrap on the worker thread only a PyScript module.
|
||||
* @param {string} file the python file to run ina worker.
|
||||
* @param {{config?: string | object, async?: boolean}} [options] optional configuration for the worker.
|
||||
* @returns {Worker & {sync: ProxyHandler<object>}}
|
||||
*/
|
||||
export function PyWorker(
|
||||
file: string,
|
||||
options?: {
|
||||
config?: string | object;
|
||||
async?: boolean;
|
||||
},
|
||||
): Worker & {
|
||||
sync: ProxyHandler<object>;
|
||||
};
|
||||
export namespace hooks {
|
||||
let onBeforeRun: Set<Function>;
|
||||
let onBeforeRunAync: Set<Function>;
|
||||
let onAfterRun: Set<Function>;
|
||||
let onAfterRunAsync: Set<Function>;
|
||||
let onInterpreterReady: Set<Function>;
|
||||
let codeBeforeRunWorker: Set<string>;
|
||||
let codeBeforeRunWorkerAsync: Set<string>;
|
||||
let codeAfterRunWorker: Set<string>;
|
||||
let codeAfterRunWorkerAsync: Set<string>;
|
||||
}
|
||||
declare let config: any;
|
||||
export {};
|
||||
32
pyscript.next/types/exceptions.d.ts
vendored
Normal file
32
pyscript.next/types/exceptions.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
export function _createAlertBanner(
|
||||
message: any,
|
||||
level: any,
|
||||
messageType?: string,
|
||||
logMessage?: boolean,
|
||||
): void;
|
||||
export namespace ErrorCode {
|
||||
let GENERIC: string;
|
||||
let FETCH_ERROR: string;
|
||||
let FETCH_NAME_ERROR: string;
|
||||
let FETCH_UNAUTHORIZED_ERROR: string;
|
||||
let FETCH_FORBIDDEN_ERROR: string;
|
||||
let FETCH_NOT_FOUND_ERROR: string;
|
||||
let FETCH_SERVER_ERROR: string;
|
||||
let FETCH_UNAVAILABLE_ERROR: string;
|
||||
let BAD_CONFIG: string;
|
||||
let MICROPIP_INSTALL_ERROR: string;
|
||||
let BAD_PLUGIN_FILE_EXTENSION: string;
|
||||
let NO_DEFAULT_EXPORT: string;
|
||||
let TOP_LEVEL_AWAIT: string;
|
||||
}
|
||||
export class UserError extends Error {
|
||||
constructor(errorCode: any, message?: string, messageType?: string);
|
||||
errorCode: any;
|
||||
messageType: string;
|
||||
}
|
||||
export class FetchError extends UserError {
|
||||
constructor(errorCode: any, message: any);
|
||||
}
|
||||
export class InstallError extends UserError {
|
||||
constructor(errorCode: any, message: any);
|
||||
}
|
||||
10
pyscript.next/types/fetch.d.ts
vendored
Normal file
10
pyscript.next/types/fetch.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* This is a fetch wrapper that handles any non 200 responses and throws a
|
||||
* FetchError with the right ErrorCode. This is useful because our FetchError
|
||||
* will automatically create an alert banner.
|
||||
*
|
||||
* @param {string} url - URL to fetch
|
||||
* @param {Request} [options] - options to pass to fetch
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export function robustFetch(url: string, options?: Request): Promise<Response>;
|
||||
Reference in New Issue
Block a user