Skip to content

Commit 3ff68ab

Browse files
committed
Added possibility to register for events
1 parent 1e9273d commit 3ff68ab

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

jquery-cropbox/jquery-cropbox-tests.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ cropboxWithOptions.update();
3737
cropboxWithOptions.getDataURL();
3838
cropboxWithOptions.getBlob();
3939
cropboxWithOptions.remove();
40+
41+
cropboxWithOptions.on("cropbox",(e: Event, data: any, img: jQueryCropBox.Cropbox) => {
42+
43+
//DoStuff
44+
45+
});

jquery-cropbox/jquery-cropbox.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,13 @@ declare module jQueryCropBox {
103103
* Remove the cropbox functionality from the image.
104104
*/
105105
remove(): void;
106+
/**
107+
* Attach an event handler function for one event on the Crop Box
108+
*/
109+
on(event: string, callback: jQueryCropBox.EventCallback): void;
106110
}
111+
112+
type EventCallback = (e: Event, data: any, img: jQueryCropBox.Cropbox) => void;
107113
}
108114

109115
interface JQuery {

0 commit comments

Comments
 (0)