Skip to content

Commit

Permalink
Merge pull request #241 from Fyzu/types
Browse files Browse the repository at this point in the history
Add `.d.ts` types for plugin
  • Loading branch information
wbotelhos committed Oct 10, 2022
2 parents bb63b63 + 707c251 commit cfd29af
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
],
"license": "MIT",
"main": "src/raty.js",
"types": "src/raty.d.ts",
"maintainers": [
"Washington Botelho <wbotelhos@gmail.com> (https://www.wbotelhos.com)"
],
Expand Down
59 changes: 59 additions & 0 deletions src/raty.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
export interface RatyOptions {
cancelButton: boolean;
cancelClass: string;
cancelHint: string;
cancelOff: string;
cancelOn: string;
cancelPlace: string;
click: (score: number, element: HTMLElement, evt: MouseEvent) => void;
half: boolean;
halfShow: boolean;
hints: string[];
iconRange: { range: number; on: string; off: string }[];
iconRangeSame: boolean;
mouseout: (score: number, element: HTMLElement, evt: MouseEvent) => void;
mouseover: (score: number, element: HTMLElement, evt: MouseEvent) => void;
noRatedMsg: string;
number: () => number | number;
numberMax: number;
path: () => string | string;
precision: boolean;
readOnly: () => boolean | boolean;
round: { down: number; full: number; up: number };
score: () => number | number;
scoreName: string;
single: boolean;
space: boolean;
starHalf: string;
starOff: string;
starOn: string;
starType: string;
target: string;
targetFormat: string;
targetKeep: boolean;
targetScore: string;
targetText: string;
targetType: string;
}

export declare class Raty {
constructor(element: HTMLElement, options?: Partial<RatyOptions>);

defaultOptions(): Partial<RatyOptions>;

cancel(click: boolean);

click(score: number): void;

move(score: number): void;

readOnly(readOnly: boolean): void;

score(): number;
score(score: number): void

setScore(score: number): void;
getScore(): number;

init(): Raty
}

0 comments on commit cfd29af

Please sign in to comment.