seamless-scroll-polyfill
Advanced tools
Comparing version 2.2.1 to 2.3.0
@@ -0,1 +1,8 @@ | ||
# [2.3.0](https://github.com/magic-akari/seamless-scroll-polyfill/compare/v2.2.1...v2.3.0) (2023-01-26) | ||
### Features | ||
* support scrollend event ([5072b41](https://github.com/magic-akari/seamless-scroll-polyfill/commit/5072b418f88e842105138b6159729e1a564a1357)) | ||
## [2.2.1](https://github.com/magic-akari/seamless-scroll-polyfill/compare/v2.2.0...v2.2.1) (2023-01-26) | ||
@@ -2,0 +9,0 @@ |
import { backupMethod, checkBehavior, elementScrollXY, failedExecute, failedExecuteInvalidEnumValue, isObject, scrollingElement, } from "./common.js"; | ||
import { scrollEndEvent } from "./scroll-end-event.js"; | ||
import { now, step } from "./scroll-step.js"; | ||
@@ -38,6 +39,12 @@ // https://drafts.csswg.org/cssom-view/#normalize-non-finite-values | ||
}; | ||
const callback = () => { | ||
removeEventListener(); | ||
const isDocument = element.nodeType === /** Node.DOCUMENT_NODE */ 9; | ||
element.dispatchEvent(scrollEndEvent(isDocument)); | ||
}; | ||
const context = Object.assign(Object.assign({}, config), { timeStamp: now(), startX, | ||
startY, | ||
targetX, | ||
targetY, rafId: 0, method, callback: removeEventListener }); | ||
targetY, rafId: 0, method, | ||
callback }); | ||
const cancelScroll = () => { | ||
@@ -44,0 +51,0 @@ window.cancelAnimationFrame(context.rafId); |
@@ -5,3 +5,3 @@ { | ||
"description": "Smooth Scroll behavior polyfill", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"author": { | ||
@@ -8,0 +8,0 @@ "name": "Dustan Kasten", |
@@ -10,2 +10,3 @@ import { | ||
} from "./common.js"; | ||
import { scrollEndEvent } from "./scroll-end-event.js"; | ||
import type { IContext, IScrollConfig } from "./scroll-step"; | ||
@@ -59,2 +60,8 @@ import { now, step } from "./scroll-step.js"; | ||
const callback = () => { | ||
removeEventListener(); | ||
const isDocument = element.nodeType === /** Node.DOCUMENT_NODE */ 9; | ||
element.dispatchEvent(scrollEndEvent(isDocument)); | ||
}; | ||
const context: IContext = { | ||
@@ -69,3 +76,3 @@ ...config, | ||
method, | ||
callback: removeEventListener, | ||
callback, | ||
}; | ||
@@ -72,0 +79,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
241314
68
2339