/**
 * 小程序粘贴
 *
 * @param {string} text 待复制的文本
 * @returns {Promise<void>}
 * @example
 *
 * ```ts
 * clipboardMp('stupid').then(() => {});
 * ```
 */
function clipboardMp(text) {
  return new Promise(function (resolve, reject) {
    if (wx) {
      wx.setClipboardData({
        data: "".concat(text),
        success: function success(res) {
          resolve(res);
        },
        fail: function fail(error) {
          console.info('[clipboardMp] error: ', error);
          reject(error);
        }
      });
    } else {
      reject();
    }
  });
}

export { clipboardMp };
