如何在Salesforce闪电组件中使用waveurfer.js?

时间:2019-02-28 20:59:09

标签: salesforce-lightning wavesurfer.js

以下waveurfer html / javascript代码在html页面中可以正常工作。但是我无法使其在saleforce闪电组件中工作。有人可以帮忙吗?谢谢!

我知道用于在线mp3的SF“ CSP可信站点定义”和用于包含wavesurfer.js文件的“静态资源”。

我收到错误消息,

未捕获的TypeError:无法构造'OfflineAudioContext':请使用'new'运算符,此DOM对象构造函数不能作为函数调用。

dateRestriction = () => {
const date = new Date();
const nutrition_offset = date.getTimezoneOffset() + 240;
date.setMinutes(date.getMinutes() + nutrition_offset);
const year = date.getFullYear();

let month = date.getMonth() + 1;
if (month < 10) {
  month = ('0' + month)
}

let day = date.getDate();
if ((date.getDay() === 4) || (date.getDay() === 5)) {
  if (date.getDate() < 5) {
    day = ('0' + (date.getDate() + 5));
  } else {
    day = date.getDate() + 5;
  }
}
if (date.getDay() === 6) {
  if (date.getDate() < 6) {
    day = ('0' + (date.getDate() + 4));
  } else {
    day = date.getDate() + 4;
  }
}
if ((date.getDay() === 0) || (date.getDay() === 1) || (date.getDay() === 2) || (date.getDay() === 3)) {
  if (date.getDate() < 7) {
    day = ('0' + (date.getDate() + 3));
  } else {
    day = date.getDate() + 3;
  }
}

let dateRestricted = this.parseDate_(year + '-' + month + '-' + day);

this.setState({
  noDay: dateRestricted,
  currentYear: year
});
}

0 个答案:

没有答案
相关问题