|
|
@ -46,10 +46,14 @@ export const ResizeDetector = { |
|
|
|
addResizeListener(widget.element[0], fn); |
|
|
|
addResizeListener(widget.element[0], fn); |
|
|
|
|
|
|
|
|
|
|
|
return function () { |
|
|
|
return function () { |
|
|
|
|
|
|
|
// 如果fn是debounce需要cancel掉
|
|
|
|
|
|
|
|
fn?.cancel?.(); |
|
|
|
removeResizeListener(widget.element[0], fn); |
|
|
|
removeResizeListener(widget.element[0], fn); |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
removeResizeListener(widget, fn) { |
|
|
|
removeResizeListener(widget, fn) { |
|
|
|
|
|
|
|
// 如果fn是debounce需要cancel掉
|
|
|
|
|
|
|
|
fn?.cancel?.(); |
|
|
|
removeResizeListener(widget.element[0], fn); |
|
|
|
removeResizeListener(widget.element[0], fn); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|