提交 d4d7ef6d 编写于 作者: K Kamran Ahmed

Added callback for when popover is about to reset

上级 f615c73f
......@@ -170,6 +170,7 @@ const driver = new Driver({
onHighlightStarted: (Element) {}, // Called when element is about to be highlighted
onHighlighted: (Element) {}, // Called when element is fully highlighted
onDeselected: (Element) {}, // Called when element has been deselected
onReset: () {}, // Called when element has been deselected
});
```
Note that all the button options that you provide in the driver definition can be overridden for a specific step by giving them in the step definition
......
......@@ -132,6 +132,11 @@ export default class Overlay {
* @public
*/
clear(immediate = false) {
// Callback for when overlay is about to be reset
if (this.options.onReset) {
this.options.onReset();
}
// Deselect the highlighted element if any
if (this.highlightedElement) {
const hideStage = true;
......
......@@ -38,6 +38,8 @@ export default class Driver {
},
onDeselected: () => { // When the element has been deselected
},
onReset: () => { // When overlay is about to be cleared
},
...options,
};
......
......@@ -701,6 +701,11 @@ declare module 'driver.js' {
* @returns any
*/
onDeselected?: (element: Driver.Element) => void,
/**
* Is called when the overlay is about to reset
*/
onReset?: () => void,
}
interface ElementOptions extends Driver.DriverOptions {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册