mirror of
https://github.com/webslides/WebSlides.git
synced 2025-08-23 13:23:23 +02:00
Avoiding to use Array.from
This commit is contained in:
@@ -141,7 +141,7 @@ export default class WebSlides {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
grabSlides_() {
|
grabSlides_() {
|
||||||
this.slides = Array.from(this.el.childNodes)
|
this.slides = DOM.toArray(this.el.childNodes)
|
||||||
.map((slide, i) => new Slide(slide, i));
|
.map((slide, i) => new Slide(slide, i));
|
||||||
|
|
||||||
this.maxSlide_ = this.slides.length;
|
this.maxSlide_ = this.slides.length;
|
||||||
|
@@ -72,4 +72,13 @@ export default class DOM {
|
|||||||
|
|
||||||
target.dispatchEvent(event);
|
target.dispatchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an iterable to an array.
|
||||||
|
* @param {*} iterable Element to convert to array
|
||||||
|
* @return {Array} the element casted to an array.
|
||||||
|
*/
|
||||||
|
static toArray(iterable) {
|
||||||
|
return [].slice.call(iterable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user