javascript - 如何转换此箭头函数?
问题描述
我不知道如何将此箭头函数转换为 IE 兼容函数。如果有人可以为此提供解决方案,我真的很感激:
const store = window.WebChat.createStore({}, ({ dispatch }) => next => async action => {
if (action.type === 'DIRECT_LINE/POST_ACTIVITY') {
// Mocking data to be sent
const userId = 'xyz789';
const payloadUserContext = action.payload;
action = window.simpleUpdateIn(
action,
['payload', 'activity', 'channelData'],
() => ({
'personId': userId,
'domain': $.urlParam('d'),
'environment': window.location.host,
'userContext': payloadUserContext
})
)
}
return next(action);
});
解决方案
var store = window.WebChat.createStore({}, function (_ref) {
var dispatch = _ref.dispatch;
return function (next) {
return async function (action) {
if (action.type === 'DIRECT_LINE/POST_ACTIVITY') {
// Mocking data to be sent
var userId = 'xyz789';
var payloadUserContext = action.payload;
action = window.simpleUpdateIn(action, ['payload', 'activity', 'channelData'], function () {
return {
'personId': userId,
'domain': $.urlParam('d'),
'environment': window.location.host,
'userContext': payloadUserContext
};
});
}
return next(action);
};
};
});
推荐阅读
- sql - 创建键值对表
- python - 包含用于 collections.Counter 的相关方法
- azure-data-lake - 我们可以使用交互式集群从数据块在 adls2 之上创建外部表吗?
- python - 你怎么知道什么时候应该使用记忆?
- python - 如何处理 html 文件上的内存错误?
- azure - 如何配置 Azure CI/CD 以更新最新更改
- c# - C# 中的异步分块文件上传
- swiftui - Apple Watch 上的 SwiftUI NavigationView 在子视图中触发 onAppear 的多次调用
- java - 使用 java 将 JSONArray 转换为 csv
- javascript - 如何从 React 中的 Observable Map 中过滤?