supercharged-slider
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -139,2 +139,11 @@ var index = ""; | ||
prev: () => instance.slideTo(instance.activeView - 1), | ||
render: () => { | ||
runCleanUpHooks(); | ||
instance.slideWidth = instance.element.clientWidth; | ||
instance.slideStyles.width = `${instance.slideWidth}px`; | ||
instance.spaceBetween = 0; | ||
runMiddlewares(middlewares, instance); | ||
instance.updateSlideStyles(); | ||
instance.slideTo(instance.activeView, true); | ||
}, | ||
updateSlideStyles: () => slides.forEach( | ||
@@ -148,13 +157,4 @@ (slide) => Object.assign(slide.style, instance.slideStyles) | ||
}; | ||
const processMiddlewares = () => { | ||
runCleanUpHooks(); | ||
instance.slideWidth = instance.element.clientWidth; | ||
instance.slideStyles.width = `${instance.slideWidth}px`; | ||
instance.spaceBetween = 0; | ||
runMiddlewares(middlewares, instance); | ||
instance.updateSlideStyles(); | ||
instance.slideTo(instance.activeView, true); | ||
}; | ||
processMiddlewares(); | ||
window.addEventListener("resize", debounce(processMiddlewares, 300)); | ||
instance.render(); | ||
window.addEventListener("resize", debounce(instance.render, 300)); | ||
return instance; | ||
@@ -161,0 +161,0 @@ }; |
@@ -17,2 +17,3 @@ export declare type Hook<T extends unknown> = (props?: T) => void; | ||
prev: () => void; | ||
render: () => void; | ||
slideTo: (index: number, silent?: boolean) => void; | ||
@@ -19,0 +20,0 @@ updateSlideStyles: () => void; |
{ | ||
"name": "supercharged-slider", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "A super modular tiny slider library.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -17,2 +17,3 @@ export type Hook<T extends unknown> = (props?: T) => void; | ||
prev: () => void | ||
render: () => void | ||
slideTo: (index: number, silent?: boolean) => void | ||
@@ -19,0 +20,0 @@ updateSlideStyles: () => void |
@@ -99,2 +99,15 @@ import { Middleware, Hook, Slider } from '~/types'; | ||
prev: () => instance.slideTo(instance.activeView - 1), | ||
render: () => { | ||
runCleanUpHooks(); | ||
instance.slideWidth = instance.element.clientWidth; | ||
instance.slideStyles.width = `${instance.slideWidth}px`; | ||
instance.spaceBetween = 0; | ||
runMiddlewares(middlewares, instance); | ||
instance.updateSlideStyles(); | ||
instance.slideTo(instance.activeView, true); | ||
}, | ||
updateSlideStyles: () => slides.forEach( | ||
@@ -109,21 +122,7 @@ (slide) => Object.assign(slide.style, instance.slideStyles), | ||
const processMiddlewares = () => { | ||
runCleanUpHooks(); | ||
instance.render(); | ||
window.addEventListener('resize', debounce(instance.render, 300)); | ||
instance.slideWidth = instance.element.clientWidth; | ||
instance.slideStyles.width = `${instance.slideWidth}px`; | ||
instance.spaceBetween = 0; | ||
runMiddlewares(middlewares, instance); | ||
instance.updateSlideStyles(); | ||
instance.slideTo(instance.activeView, true); | ||
}; | ||
processMiddlewares(); | ||
window.addEventListener('resize', debounce(processMiddlewares, 300)); | ||
return instance; | ||
}; | ||
export default createSlider; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38595
974