当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript state.updateWorkspace函数代码示例

本文整理汇总了TypeScript中front-end/state.updateWorkspace函数的典型用法代码示例。如果您正苦于以下问题:TypeScript updateWorkspace函数的具体用法?TypeScript updateWorkspace怎么用?TypeScript updateWorkspace使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了updateWorkspace函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: switch

const dndReducer = (state: ApplicationState, event: BaseEvent) => {
  switch(event.type) {
    case DND_STARTED: {
      const { ref }  = event as DNDEvent;
      return updateWorkspace(state, state.selectedWorkspaceId, {
        draggingRefs: [ref]
      })
    }
    case DND_HANDLED: {
      return updateWorkspace(state, state.selectedWorkspaceId, {
        draggingRefs: []
      });
    }
  }
  return state;
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:16,代码来源:index.ts

示例2: createApplicationState

export const applicationReducer = (state: ApplicationState = createApplicationState(), event: BaseEvent) => {
  switch(event.type) {
    
    case LOADED_SAVED_STATE: {
      const { state: newState } = event as LoadedSavedState;
      state = merge({}, state, JSON.parse(JSON.stringify(newState)));
      break;
    }
    
    case TREE_NODE_LABEL_CLICKED: {
      const { node } = event as TreeNodeLabelClicked;
      state = updateWorkspace(state, state.selectedWorkspaceId, {
        selectedFileId: node.$id
      });
      break;
    }

    case TOGGLE_TARGET_CSS_TARGET_SELECTOR_CLICKED: {
      console.warn("TODO CSS ")
      // const { itemId, artboardId } = event as ToggleCSSTargetSelectorClicked;
      // const artboard = getArtboardById(artboardId, state);
      // const item = getNestedObjectById(itemId, artboard.document);
      // const workspace = getArtboardWorkspace(artboard.$id, state);;
      // state = toggleWorkspaceTargetCSSSelector(state, workspace.$id, item.source.uri, (item as any as SyntheticCSSStyleRule).selectorText);
      break;
    }
  }
  
  state = artboardReducer(state, event);
  state = stageReducer(state, event);
  state = cssInspectorReducer(state, event);
  state = workspaceReducer(state, event);
  state = artboardPaneReducer(state, event);
  state = componentsPaneReducer(state, event);
  state = shortcutReducer(state, event);
  state = apiReducer(state, event);
  state = dndReducer(state, event);

  return state;
};
开发者ID:cryptobuks,项目名称:tandem,代码行数:40,代码来源:index.ts


注:本文中的front-end/state.updateWorkspace函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。