<NME> promisify.js
<BEF> export function wxPromise (fn) {
  return function (obj = {}) {
    return new Promise((resolve, reject) => {
      obj.success = function (res) {
        resolve(res)
      }
      obj.fail = function (err) {
        reject(err)
      }
      fn(obj)
    })
  }
}

export function draw (ctx, reserve = false) {
  return new Promise((resolve) => {
    ctx.draw && ctx.draw(reserve, resolve)
  })
}

export const getImageInfo = wxPromise(wx.getImageInfo)

export const canvasToTempFilePath = wxPromise(wx.canvasToTempFilePath)

export const loadCanvasImage = (context, src) => {
  return new Promise((resolve, reject) => {
    if (context.type === '2d') {
      const img = context.canvas.createImage()
      img.onload = () => {
        resolve(img)
      }
      img.onerror = (e) => {
        reject(e)
      }
      img.src = src
    } else {
      resolve(src)
    }
  })
}

<MSG> feat(src/methods/getCropperImage): support componentContext option

<DFF> @@ -1,5 +1,5 @@
 export function wxPromise (fn) {
-  return function (obj = {}) {
+  return function (obj = {}, ...args) {
     return new Promise((resolve, reject) => {
       obj.success = function (res) {
         resolve(res)
@@ -7,7 +7,7 @@ export function wxPromise (fn) {
       obj.fail = function (err) {
         reject(err)
       }
-      fn(obj)
+      fn(obj, ...args)
     })
   }
 }

feat(src/methods/getCropperImage): support componentContext option