How to use array-from - 4 common examples

To help you get started, we’ve selected a few array-from examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chaogao / jsmod-pc-vue / src / components / utils / swiper.js View on Github external
_setTransform (offset) {
    const me = this
    offset = offset || 0

    arrayFrom(me.$items).forEach(function ($item, key) {
      let transformCallback = function () {
        let distance = me._offset[key] + offset
        let transform = `translate(${distance}px, 0)`

        if (me._options.direction === 'vertical') {
          transform = `translate(0, ${distance}px)`
        }

        $item.style.webkitTransform = transform
        $item.style.transform = transform
      }

      // opacity 要先改变
      me._options.useFade && ($item.style.opacity = 0);

      if ((me._options.useFade && key == me._current) || !me._options.useFade) {
github chaogao / jsmod-pc-vue / src / components / utils / swiper.js View on Github external
_setOffset () {
    let me = this
    let index = me._position.indexOf(me._current)
    me._offset = []
    arrayFrom(me.$items).forEach(function ($item, key) {
      me._offset.push((key - index) * me._distance)
    })
  }
github chaogao / jsmod-pc-vue / src / components / utils / swiper.js View on Github external
_setTransition (duration) {
    let me = this;
    duration = duration || (this._options.duration || 'none')
    let transition = duration === 'none' ? 'none' : (this._options.useFade ? 'opacity ' : 'transform ') + duration + 'ms'
    arrayFrom(this.$items).forEach(function ($item, key) {
      $item.style.webkitTransition = transition
      $item.style.transition = transition
    })
  }
github chaogao / jsmod-pc-vue / src / components / utils / swiper.js View on Github external
_itemDestoy () {
    this.$items.length && arrayFrom(this.$items).forEach(item => {
      item.removeEventListener('webkitTransitionEnd', this.transitionEndHandler, false)
    })
  }

array-from

A ponyfill for the ES 2015 (ES6) `Array.from()`.

MIT
Latest version published 9 years ago

Package Health Score

55 / 100
Full package analysis

Popular array-from functions