MCPcopy
hub / github.com/Splidejs/splide / init

Function init

src/js/components/Controller/Controller.ts:99–111  ·  view source on GitHub ↗

* Initializes some parameters. * Needs to check the number of slides since the current index may be out of the range after refresh. * The process order must be Elements -> Controller -> Move.

()

Source from the content-addressed store, hash-verified

97 * The process order must be Elements -> Controller -> Move.
98 */
99 function init(): void {
100 slideCount = getLength( true );
101 perMove = options.perMove;
102 perPage = options.perPage;
103 endIndex = getEnd();
104
105 const index = clamp( currIndex, 0, omitEnd ? endIndex : slideCount - 1 );
106
107 if ( index !== currIndex ) {
108 currIndex = index;
109 Move.reposition();
110 }
111 }
112
113 /**
114 * Called when the viewport width is changed.

Callers 1

mountFunction · 0.70

Calls 4

clampFunction · 0.90
getLengthFunction · 0.85
getEndFunction · 0.85
repositionMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…