Skip to content

Commit 3dfd08f

Browse files
authored
Merge pull request #13 from bajrangCoder/main
Added typings
2 parents f4860da + 709ea2d commit 3dfd08f

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

typings/acode.d.ts

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
2+
export default class acode {
3+
/**
4+
* Define a module
5+
* @param {string} name
6+
* @param {Object|function} module
7+
*/
8+
define(name: string, module: any): void;
9+
10+
require(module: string): any;
11+
12+
exec(key: string, val: any): boolean | undefined;
13+
14+
get exitAppMessage(): string | undefined;
15+
16+
setLoadingMessage(message: string): void;
17+
18+
setPluginInit(id: string, initFunction: (baseUrl: string, $page: HTMLElement, options?: any) => Promise<void>, settings: any): void;
19+
20+
getPluginSettings(id: string): any;
21+
22+
setPluginUnmount(id: string, unmountFunction: () => void): void;
23+
24+
/**
25+
* @param {string} id plugin id
26+
* @param {string} baseUrl local plugin url
27+
* @param {HTMLElement} $page
28+
*/
29+
initPlugin(id: string, baseUrl: string, $page: HTMLElement, options?: any): Promise<void>;
30+
31+
unmountPlugin(id: string): void;
32+
33+
registerFormatter(id: string, extensions: string[], format: () => Promise<void>): void;
34+
35+
unregisterFormatter(id: string): void;
36+
37+
format(selectIfNull?: boolean): Promise<void>;
38+
39+
fsOperation(file: string): any;
40+
41+
newEditorFile(filename: string, options?: any): void;
42+
43+
// readonly formatters(): { id: string; name: string; exts: string[] }[];
44+
45+
/**
46+
* @param {string[]} extensions
47+
* @returns {Array<[id: string, name: string]>} options
48+
*/
49+
getFormatterFor(extensions: string[]): [id: string, name: string][];
50+
51+
alert(title: string, message: string, onhide: ()=>void): void;
52+
53+
loader(title: string, message: string, cancel: { timeout: number,callback: ()=>void }): void;
54+
55+
joinUrl(...args: string): string;
56+
57+
addIcon(className: string, src: string): void;
58+
59+
prompt(
60+
message: string,
61+
defaultValue: string,
62+
type: 'textarea' | 'text' | 'number' | 'tel' | 'search' | 'email' | 'url',
63+
options?: {
64+
match: RegExp,
65+
required: boolean,
66+
placeholder: string,
67+
test: (any)=>boolean
68+
}
69+
): Promise<any>;
70+
71+
confirm(title: string, message: string): Promise<boolean>;
72+
73+
select(
74+
title: string,
75+
options: string[string, string, string, boolean] | string,
76+
opts?: {
77+
onCancel?: () => void;
78+
onHide?: () => void;
79+
hideOnSelect?: boolean;
80+
textTransform?: boolean;
81+
default?: string;
82+
} | rejectOnCancel: boolean
83+
): Promise<any>;
84+
85+
type Input = string;
86+
87+
type Strings = string[];
88+
89+
multiPrompt(title: string, inputs: Array<Input | Input[]>, help: string): Promise<Strings>;
90+
91+
fileBrowser(mode: 'file' | 'folder' | 'both', info: string, doesOpenLast: boolean): Promise<import('.').SelectedFile>;
92+
93+
toInternalUrl(url:string): Promise<url: string>;
94+
}

0 commit comments

Comments
 (0)