embla-carousel-autoplay
Advanced tools
Comparing version 7.0.9 to 7.1.0
@@ -8,3 +8,3 @@ import { AutoplayOptionsType, OptionsType } from './Options'; | ||
} | ||
export declare type AutoplayType = CreatePluginType<{ | ||
export type AutoplayType = CreatePluginType<{ | ||
play: (jump?: boolean) => void; | ||
@@ -11,0 +11,0 @@ stop: () => void; |
import { CreateOptionsType } from 'embla-carousel/components/Options'; | ||
export declare type OptionsType = CreateOptionsType<{ | ||
export type OptionsType = CreateOptionsType<{ | ||
delay: number; | ||
@@ -12,2 +12,2 @@ jump: boolean; | ||
export declare const defaultOptions: OptionsType; | ||
export declare type AutoplayOptionsType = Partial<OptionsType>; | ||
export type AutoplayOptionsType = Partial<OptionsType>; |
@@ -29,3 +29,2 @@ 'use strict'; | ||
var jump = false; | ||
function init(embla) { | ||
@@ -41,3 +40,2 @@ carousel = embla; | ||
if (!options.stopOnInteraction) carousel.on('pointerUp', reset); | ||
if (options.stopOnMouseEnter) { | ||
@@ -47,3 +45,2 @@ eventStore.add(root, 'mouseenter', interaction); | ||
} | ||
eventStore.add(document, 'visibilitychange', function () { | ||
@@ -58,3 +55,2 @@ if (document.visibilityState === 'hidden') return stop(); | ||
} | ||
function destroy() { | ||
@@ -66,3 +62,2 @@ carousel.off('pointerDown', interaction); | ||
} | ||
function play(jumpOverride) { | ||
@@ -73,3 +68,2 @@ stop(); | ||
} | ||
function stop() { | ||
@@ -79,3 +73,2 @@ if (!timer) return; | ||
} | ||
function reset() { | ||
@@ -86,3 +79,2 @@ if (!timer) return; | ||
} | ||
function next() { | ||
@@ -92,3 +84,2 @@ var index = carousel.internalEngine().index; | ||
if (kill) return destroy(); | ||
if (carousel.canScrollNext()) { | ||
@@ -99,6 +90,4 @@ carousel.scrollNext(jump); | ||
} | ||
play(); | ||
} | ||
var self = { | ||
@@ -115,3 +104,2 @@ name: 'autoplay', | ||
} | ||
Autoplay.globalOptions = undefined; | ||
@@ -118,0 +106,0 @@ |
@@ -23,3 +23,2 @@ import EmblaCarousel from 'embla-carousel'; | ||
var jump = false; | ||
function init(embla) { | ||
@@ -35,3 +34,2 @@ carousel = embla; | ||
if (!options.stopOnInteraction) carousel.on('pointerUp', reset); | ||
if (options.stopOnMouseEnter) { | ||
@@ -41,3 +39,2 @@ eventStore.add(root, 'mouseenter', interaction); | ||
} | ||
eventStore.add(document, 'visibilitychange', function () { | ||
@@ -52,3 +49,2 @@ if (document.visibilityState === 'hidden') return stop(); | ||
} | ||
function destroy() { | ||
@@ -60,3 +56,2 @@ carousel.off('pointerDown', interaction); | ||
} | ||
function play(jumpOverride) { | ||
@@ -67,3 +62,2 @@ stop(); | ||
} | ||
function stop() { | ||
@@ -73,3 +67,2 @@ if (!timer) return; | ||
} | ||
function reset() { | ||
@@ -80,3 +73,2 @@ if (!timer) return; | ||
} | ||
function next() { | ||
@@ -86,3 +78,2 @@ var index = carousel.internalEngine().index; | ||
if (kill) return destroy(); | ||
if (carousel.canScrollNext()) { | ||
@@ -93,6 +84,4 @@ carousel.scrollNext(jump); | ||
} | ||
play(); | ||
} | ||
var self = { | ||
@@ -109,3 +98,2 @@ name: 'autoplay', | ||
} | ||
Autoplay.globalOptions = undefined; | ||
@@ -112,0 +100,0 @@ |
{ | ||
"name": "embla-carousel-autoplay", | ||
"version": "7.0.9", | ||
"version": "7.1.0", | ||
"author": "David Jerleke", | ||
@@ -58,4 +58,4 @@ "description": "An autoplay plugin for Embla Carousel", | ||
"peerDependencies": { | ||
"embla-carousel": "7.0.9" | ||
"embla-carousel": "7.1.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
27595