const lodop = function() {
  return new Promise((resolve, reject) => {
    if (!window.getLodop) {
      var hm = document.createElement('script')
      hm.src = '/static/LodopFuncs.js'
      hm.onload = function() {
        console.log('lodop.js已加载')
        // 加载js文件后会自动链接ws,等一会再操作
        setTimeout(res => {
          resolve(getLodop())
        }, 500)
      }
      hm.onerror = function(err) {
        reject(err)
      }
      var s = document.getElementsByTagName('script')[0]
      s.parentNode.insertBefore(hm, s)
    } else resolve(getLodop())
  })
}
export default lodop

