How to use the @cycjimmy/awesome-js-funcs/typeConversion/functionToPromise function in @cycjimmy/awesome-js-funcs

To help you get started, we’ve selected a few @cycjimmy/awesome-js-funcs 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 cycjimmy / swiper-animation / src / index.js View on Github external
_initAllBoxes() {
    if (this.allBoxes.length) {
      return Promise.resolve();
    }

    return functionToPromise(() => {
      let swiperWrapper = null;

      if (this.swiper.wrapperEl) {
        // swiper 4+
        swiperWrapper = this.swiper.wrapperEl;
      } else if (this.swiper.wrapper) {
        // swiper 3.x
        swiperWrapper = this.swiper.wrapper[0];
      }

      this.allBoxes = [
        ...nodeListToArray(swiperWrapper.querySelectorAll('[data-swiper-animation]')),
        ...nodeListToArray(swiperWrapper.querySelectorAll('[data-swiper-animation-once]'))
      ];
    });
  }
github cycjimmy / h5-webpack-starter / app / loadingComponent / Loading.component.js View on Github external
render() {
    return functionToPromise(() => {
      this.context.innerHTML = templateLoading({_style, imgLoading});
      document.body.appendChild(this.context);
    });
  };
github cycjimmy / h5-webpack-starter / app / share / promptOrientation / PromptOrientation.component.ins.js View on Github external
load() {
    return functionToPromise(() => {
      this.wrapper.innerHTML = promptOrientation({
        _style,
        suggest: 'Turn to portrait for better experience.',
      });
    }).then(() => {
      document.body.appendChild(this.wrapper);
    });
  };
github cycjimmy / h5-webpack-starter / app / share / Component / index.js View on Github external
render({
           pugTemplate,
           wrapperElement,
           insetParam,
           isAddToEl = false,
         }) {
    return functionToPromise(() => new Templates(pugTemplate, wrapperElement, insetParam).load(isAddToEl));
  };
github cycjimmy / swiper-animation / src / index.js View on Github external
const runOutTasks = this.activeBoxes.map((el) => {
      if (el.animationData.isRecovery) {
        return Promise.resolve();
      }

      if (!el.animationData.outEffect) {
        return Promise.resolve();
      }

      return functionToPromise(() => {
        el.style.cssText = el.styleCache;
        el.style.visibility = 'visible';
        el.style.cssText += ` animation-duration:${el.animationData.outDuration}; -webkit-animation-duration:${el.animationData.outDuration};`;

        el.classList.add(el.animationData.outEffect, 'animated');
      }, 500);
    });