/
githubmirror
/
fullPage.js
Обзор
Документация
Войти
/
githubmirror
/
fullPage.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/js/common/state.js
62 строки
1 KB
Alvaro Trigo López
- Fixed bug: error when destroy + init with active sections with slides #4703
27 май 2025, 18:35
27 май 2025, 18:35
8a8010e
Код
Авторство
О чём код?
import * as utils from './utils.js'; import { win } from './constants.js'; const defaultState = { numSections: 0, numSlides: 0, slides: [], sections: [], activeSection: null, scrollTrigger: null, isBeyondFullpage: false, aboutToScrollToFullPage: false, slideMoving: false, isResizing: false, isScrolling: false, lastScrolledDestiny: undefined, lastScrolledSlide: undefined, activeAnimation: false, canScroll: true, touchDirection: 'none', wheelDirection: 'none', isGrabbing: false, isUsingWheel: false, isWindowFocused: true, previousDestTop: 0, windowsHeight: utils.getWindowHeight(), isDoingContinousVertical: false, timeouts: {}, scrollY: 0, scrollX: 0, isFullpageInitDone: false, }; export const state = Object.assign({}, defaultState); // @ts-ignore win.state = state; export function setState(props){ Object.assign(state, props); } export function getState(){ return state; } export function getActiveDefaultSection(sections){ var section = sections.filter(section => section.isActive); if(!section.length){ return sections[0]; } return section[0]; } export function getActivePanel(){ return state.activeSection && state.activeSection.activeSlide ? state.activeSection.activeSlide : state.activeSection; } export function resetState(){ setState(defaultState); }