Skip to content

Instantly share code, notes, and snippets.

View IAIAE's full-sized avatar

Rich. Cao IAIAE

  • Tencent
  • Shenzhen China
View GitHub Profile
@IAIAE
IAIAE / estime.min.js
Created July 8, 2020 08:19
estime.min.js
!function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports.estime=t():e.estime=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){re
@IAIAE
IAIAE / polling.js
Created August 16, 2017 06:55
polling request with maxCount or maxTimeout
/**
* 轮询,直到成功
* @param {Function} promiseFunc 每次执行的回调,promiseFunc应该返回一个promise
* @param {Function} cb 用于判断promise调用是否成功
* @param {Object} config 配置: maxCount, interval, maxTimeout
*/
export default function polling(promiseFunc, cb, config) {
let count = 0;
config = config || {}
let maxCount = config.maxCount || 2;