Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
init() {
const app = this;
// Get Size
app.getSize();
// Emit resize
window.addEventListener('resize', () => {
app.emit('resize');
}, false);
// Emit orientationchange
window.addEventListener('orientationchange', () => {
app.emit('orientationchange');
});
},
orientationchange() {
init() {
const swiper = this;
// Emit resize
window.addEventListener('resize', swiper.resize.resizeHandler);
// Emit orientationchange
window.addEventListener('orientationchange', swiper.resize.orientationChangeHandler);
},
destroy() {
init() {
const swiper = this;
// Emit resize
window.addEventListener('resize', swiper.resize.resizeHandler);
// Emit orientationchange
window.addEventListener('orientationchange', swiper.resize.orientationChangeHandler);
},
destroy() {
passiveListener: (function checkPassiveListener() {
let supportsPassive = false;
try {
const opts = Object.defineProperty({}, 'passive', {
// eslint-disable-next-line
get() {
supportsPassive = true;
},
});
window.addEventListener('testPassiveListener', null, opts);
} catch (e) {
// No support
}
return supportsPassive;
}()),
function initTouch() {
const app = this;
const params = app.params.touch;
const useRipple = params[`${app.theme}TouchRipple`];
if (Device.ios && Device.webView) {
// Strange hack required for iOS 8 webview to work on inputs
window.addEventListener('touchstart', () => {});
}
let touchStartX;
let touchStartY;
let targetElement;
let isMoved;
let tapHoldFired;
let tapHoldTimeout;
let preventClick;
let activableElement;
let activeTimeout;
let rippleWave;
let rippleTarget;
let rippleTimeout;
function initTouch() {
const app = this;
const params = app.params.touch;
const useRipple = params[`${app.theme}TouchRipple`];
if (Device.ios && Device.webView) {
// Strange hack required for iOS 8 webview to work on inputs
window.addEventListener('touchstart', () => {});
}
let touchStartX;
let touchStartY;
let targetElement;
let isMoved;
let tapHoldFired;
let tapHoldTimeout;
let preventClick;
let activableElement;
let activeTimeout;
let rippleWave;
let rippleTarget;
let rippleTimeout;
passiveListener: (function checkPassiveListener() {
let supportsPassive = false;
try {
const opts = Object.defineProperty({}, 'passive', {
// eslint-disable-next-line
get() {
supportsPassive = true;
},
});
window.addEventListener('testPassiveListener', null, opts);
} catch (e) {
// No support
}
return supportsPassive;
}()),
init() {
const swiper = this;
if (!swiper.params.history) return;
if (!window.history || !window.history.pushState) {
swiper.params.history.enabled = false;
swiper.params.hashNavigation.enabled = true;
return;
}
const history = swiper.history;
history.initialized = true;
history.paths = History.getPathValues();
if (!history.paths.key && !history.paths.value) return;
history.scrollToSlide(0, history.paths.value, swiper.params.runCallbacksOnInit);
if (!swiper.params.history.replaceState) {
window.addEventListener('popstate', swiper.history.setHistoryPopState);
}
},
destroy() {
init() {
const swiper = this;
if (!swiper.params.history) return;
if (!window.history || !window.history.pushState) {
swiper.params.history.enabled = false;
swiper.params.hashNavigation.enabled = true;
return;
}
const history = swiper.history;
history.initialized = true;
history.paths = History.getPathValues();
if (!history.paths.key && !history.paths.value) return;
history.scrollToSlide(0, history.paths.value, swiper.params.runCallbacksOnInit);
if (!swiper.params.history.replaceState) {
window.addEventListener('popstate', swiper.history.setHistoryPopState);
}
},
destroy() {
init() {
const swiper = this;
if (!swiper.params.history) return;
if (!window.history || !window.history.pushState) {
swiper.params.history.enabled = false;
swiper.params.hashNavigation.enabled = true;
return;
}
const history = swiper.history;
history.initialized = true;
history.paths = History.getPathValues();
if (!history.paths.key && !history.paths.value) return;
history.scrollToSlide(0, history.paths.value, swiper.params.runCallbacksOnInit);
if (!swiper.params.history.replaceState) {
window.addEventListener('popstate', swiper.history.setHistoryPopState);
}
},
destroy() {