本文整理汇总了TypeScript中@nteract/types.CommsRecord类的典型用法代码示例。如果您正苦于以下问题:TypeScript CommsRecord类的具体用法?TypeScript CommsRecord怎么用?TypeScript CommsRecord使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CommsRecord类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: processCommMessage
function processCommMessage(
state: CommsRecord,
action: CommMessageAction
): CommsRecord {
const { data, comm_id } = action;
const commInfo = state.getIn(["info", comm_id]);
if (
commInfo &&
commInfo.get("target_module") === "reducers" &&
commInfo.get("target_name") === "setIn"
) {
const path: Array<string | number> = data.path;
const value = fromJS(data.value);
// set `value` into `path` of the model data
return state.updateIn(["models", comm_id], model =>
model.setIn(path, value)
);
}
// Default to overwrite / replace for now
return state.setIn(["models", comm_id], fromJS(data));
}
示例2: processCommOpen
function processCommOpen(
state: CommsRecord,
action: CommOpenAction
): CommsRecord {
const { target_name, target_module, data, comm_id } = action;
const commInfo = {
target_module,
target_name
};
return state
.setIn(["info", comm_id], fromJS(commInfo))
.setIn(["models", comm_id], fromJS(data));
}
示例3: registerCommTarget
function registerCommTarget(
state: CommsRecord,
action: RegisterCommTargetAction
): CommsRecord {
return state.setIn(["targets", action.name], action.handler);
}