@iris.interactive/handcook 2.6.13 → 2.6.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Welcome to HandCook 👨‍🍳
2
- ![Version](https://img.shields.io/badge/version-2.6.3-blue.svg?cacheSeconds=2592000)
2
+ ![Version](https://img.shields.io/badge/version-2.6.14-blue.svg?cacheSeconds=2592000)
3
3
  ![Prerequisite](https://img.shields.io/badge/node-%3E%3D%2012.14.0-blue.svg)
4
4
  [![License: UNLICENSED](https://img.shields.io/badge/License-UNLICENSED-yellow.svg)](#)
5
5
  [![Twitter: captain\_iris](https://img.shields.io/twitter/follow/captain\_iris.svg?style=social)](https://twitter.com/captain\_iris)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iris.interactive/handcook",
3
- "version": "2.6.13",
3
+ "version": "2.6.14",
4
4
  "description": "The web cooking by IRIS Interactive",
5
5
  "main": "./public/scripts/index.js",
6
6
  "scripts": {
@@ -25,11 +25,11 @@ export class HcSlider {
25
25
  // Options
26
26
  options = {};
27
27
 
28
- constructor(elements = ElementEnum.slider) {
28
+ constructor(elements = ElementEnum.slider, options = {}) {
29
29
  this.initOptions();
30
30
  document.querySelectorAll(elements).forEach(element => {
31
31
  this.slider = element;
32
- this.setOptions();
32
+ this.setOptions(options);
33
33
  this.buildDom();
34
34
  const instance = new Swiper(element, this.options);
35
35
  this.instances.push(instance);
@@ -37,7 +37,7 @@ export class HcSlider {
37
37
  });
38
38
  }
39
39
 
40
- setOptions() {
40
+ setOptions(options) {
41
41
  const attr = this.slider.getAttribute('data-hc-slider-autoplay');
42
42
  if (attr !== null) {
43
43
  this.options['autoplay'] = {
@@ -87,6 +87,9 @@ export class HcSlider {
87
87
  enabled: true
88
88
  }
89
89
  }
90
+
91
+ // Override option passing in function js
92
+ Object.assign( this.options, options );
90
93
  }
91
94
 
92
95
  buildDom() {
@@ -186,7 +189,7 @@ export class HcSlider {
186
189
  }
187
190
  }
188
191
 
189
- const hc_slider = function (trigger) {
190
- return new HcSlider(trigger);
192
+ const hc_slider = function (trigger, options) {
193
+ return new HcSlider(trigger, options);
191
194
  }
192
195
  export default hc_slider;