Bladeren bron

Refactoring: Need not update slide status on mount.

NaotoshiFujita 3 jaren geleden
bovenliggende
commit
5c59f29673

+ 0 - 1
dist/js/splide.cjs.js

@@ -811,7 +811,6 @@ function Slide$1(Splide2, index, slideIndex, slide) {
     if (updateOnMove) {
       on(EVENT_MOVE, onMove.bind(this));
     }
-    update.call(this);
   }
   function init() {
     if (!isClone) {

+ 0 - 1
dist/js/splide.esm.js

@@ -807,7 +807,6 @@ function Slide$1(Splide2, index, slideIndex, slide) {
     if (updateOnMove) {
       on(EVENT_MOVE, onMove.bind(this));
     }
-    update.call(this);
   }
   function init() {
     if (!isClone) {

+ 0 - 2
dist/js/splide.js

@@ -922,8 +922,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
       if (updateOnMove) {
         on(EVENT_MOVE, onMove.bind(this));
       }
-
-      update.call(this);
     }
 
     function init() {

File diff suppressed because it is too large
+ 0 - 0
dist/js/splide.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/js/splide.min.js


BIN
dist/js/splide.min.js.gz


+ 1 - 1
dist/types/components/Slides/Slide.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"Slide.d.ts","sourceRoot":"","sources":["Slide.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAmB5C;;;;GAIG;AACH,MAAM,WAAY,cAAe,SAAQ,aAAa;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,WAAW,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAI,IAAI,CAAA;IAC1E,QAAQ,CAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAI,OAAO,CAAC;CACrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAI,cAAc,CA0M7G"}
+{"version":3,"file":"Slide.d.ts","sourceRoot":"","sources":["Slide.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAmB5C;;;;GAIG;AACH,MAAM,WAAY,cAAe,SAAQ,aAAa;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,WAAW,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAI,IAAI,CAAA;IAC1E,QAAQ,CAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAI,OAAO,CAAC;CACrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAI,cAAc,CAwM7G"}

+ 0 - 2
src/js/components/Slides/Slide.ts

@@ -106,8 +106,6 @@ export function Slide( Splide: Splide, index: number, slideIndex: number, slide:
     if ( updateOnMove ) {
       on( EVENT_MOVE, onMove.bind( this ) );
     }
-
-    update.call( this );
   }
 
   /**

+ 8 - 4
src/js/test/php/examples/default.php

@@ -19,11 +19,11 @@ $settings = get_settings();
   <script>
     document.addEventListener( 'DOMContentLoaded', function () {
       var splide = new Splide( '#splide01', {
-        // type   : 'loop',
+        type   : 'loop',
         perPage: 3,
         gap    : '1.5rem',
         height : 400,
-        start  : 2,
+        // start  : 2,
         // focus  : 'center',
         // cover  : true,
         // speed: 1000,
@@ -44,8 +44,12 @@ $settings = get_settings();
         console.log( 'moved' );
       } );
 
-      splide.on( 'resized', () => {
-        console.log( 'resized' );
+      splide.on( 'visible', Slide => {
+        console.log( 'visible', Slide.index );
+      } );
+
+      splide.on( 'hidden', Slide => {
+        console.log( 'hidden', Slide.index );
       } );
 
       splide.on( 'click', () => {

Some files were not shown because too many files changed in this diff