Skip to content

Commit 5fcece5

Browse files
committed
utils: add typescript's type defenations
1 parent c9d9c82 commit 5fcece5

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

lib/utils.d.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
declare namespace ElectronElementsUtils {
2+
interface AttributeChangeOpts {
3+
addDataAttrs?: boolean,
4+
handler: Function
5+
}
6+
7+
class AttributeManager {
8+
constructor(el: Node);
9+
get(attributeName: string): null | string;
10+
set(attributeName: string, value?: string): undefined;
11+
onAttributeChange(attributes: string, opts: AttributeChangeOpts): any;
12+
onAttributeChange(attributes: Array<string>, opts: AttributeChangeOpts): any;
13+
getChangeHandlers(attr: string): Function[];
14+
createAttrToPropBridge(attr: string): Function[];
15+
}
16+
17+
class TemplateManager {
18+
constructor();
19+
add(name: string, html: string, data?: object): void;
20+
update(name: string, data: object, noCache?: boolean): void;
21+
has(name: string): boolean;
22+
get(name: string): DocumentFragment;
23+
getHTMLTemplat(name: string): string;
24+
getCachedData(name: string): object;
25+
deleteCachedData(name: string): void;
26+
updateTemplate(name: string, html: string, data?: object): void;
27+
remove(name: string): void;
28+
}
29+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.0.0",
44
"description": "Utilities for building electron elements.",
55
"main": "lib/index.js",
6+
"types": "lib/utils.d.ts",
67
"scripts": {
78
"lint": "eslint . --cache",
89
"lint-fix": "eslint . --cache --fix",

0 commit comments

Comments
 (0)