我想注入channelData與每個消息是從一個殭屍網頁控制在一個頁面發送。我環顧四周,發現這個示例(https://cmsdk.com/javascript/how-to-send-custom-channel-data-when-using-web-chat-client-with-bot-framework.html),我的代碼看起來像下面的代碼。發送channelData到網絡聊天與每條消息
問題是,這可以在Chrome中運行,但擴展運算符(...)在Edge或IE上不起作用。是否有可用於所有瀏覽器的替代語法?
var user = {
id: '@User.Identity.Name',
name: '@User.Identity.Name'
};
var bot = {
id: BotId,
name: 'BotName'
};
var botConnect = new BotChat.DirectLine({
secret: '@ViewData["BotSecret"]',
webSockets: 'true'
});
var v = { ...botConnect };
debugger;
BotChat.App({
botConnection: {
...botConnect,
postActivity: activity => {
activity.channelData = {
StudentId: '@User.Identity.Name'
};
return botConnect.postActivity(activity);
}
},
user: user,
bot: bot,
resize: 'detect'
}, document.getElementById("bot"));
邊緣應該支持每http://kangax.github.io/compat蔓延-table/es6 /#test-spread _(...)_運營商 –
我認爲您需要手動啓用實驗性功能才能正常工作,並且不希望最終用戶必須這樣做。我不認爲有一個解決方法爲IE瀏覽器。 – GaboG