當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。