• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript effects.select函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setNewGroup

export function* setNewGroup() {
	const currentUser = yield select(selectCurrentUser);
	const groups = yield select(selectGroups);
	const groupNumber = groups.length + 1;

	try {
		const newGroup = prepareGroup({
			author: currentUser.username,
			name: `Untitled group ${groupNumber}`,
			color: getRandomColor(),
			description: '(No description)'
		});

		yield put(GroupsActions.setComponentState({
			showDetails: true,
			activeGroup: null,
			totalMeshes: 0,
			newGroup,
			criteriaFieldState: INITIAL_CRITERIA_FIELD_STATE
		}));
	} catch (error) {
		yield put(DialogActions.showErrorDialog('set', 'new group', error));
	}
}
开发者ID:3drepo,项目名称:3drepo.io,代码行数:24,代码来源:groups.sagas.ts


示例2: shiftSelectedArtboard

function* shiftSelectedArtboard(indexDelta: number) {
  const state: ApplicationState = yield select();
  const workspace = getSelectedWorkspace(state);
  const artboard = getWorkspaceLastSelectionOwnerArtboard(state, state.selectedWorkspaceId) || workspace.artboards[workspace.artboards.length - 1];
  if (!artboard) {
    return;
  }

  const index = workspace.artboards.indexOf(artboard);
  const change = index + indexDelta

  // TODO - change index based on window location, not index
  const newIndex = change < 0 ? workspace.artboards.length - 1 : change >= workspace.artboards.length ? 0 : change;
  yield put(artboardSelectionShifted(workspace.artboards[newIndex].$id))
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:15,代码来源:workspace.ts


示例3: handleComponentsPaneAddClicked

function* handleComponentsPaneAddClicked() {
  while(true) {
    yield take(COMPONENTS_PANE_ADD_COMPONENT_CLICKED);
    const name = prompt("Unique component name");
    if (!name) {
      continue;
    }
    const state: ApplicationState = yield select();
    const workspace = getWorkspaceById(state, state.selectedWorkspaceId);
    const { componentId } = yield call(apiCreateComponent, name, state);
    
    console.error("TODO");
    // yield put(openSyntheticWindowRequest({ location: apiGetComponentPreviewURI(componentId, state)}, workspace.browserId));
  }
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:15,代码来源:workspace.ts


示例4: watchIndexRedirect

function* watchIndexRedirect() {
  while (true) {
    yield take(REDIRECT_TO_FIRST_FORM);

    const { forms } = yield select();

    if (forms.rows.isEmpty()) {
      var redirectTo = 'forms/new';
    } else {
      var redirectTo = `forms/${forms.rows.get(0).id}`;
    }

    yield put(routeActions.push(redirectTo));
  }
}
开发者ID:rosendi,项目名称:figure,代码行数:15,代码来源:forms.ts


示例5: toggleColorOverride

export function* toggleColorOverride({ group, render }) {
	try {
		const colorOverrides = yield select(selectColorOverrides);
		const hasColorOverride = colorOverrides[group._id];

		if (!hasColorOverride) {
			yield put(GroupsActions.addColorOverride([group]));
		} else {
			const overridedGroup = colorOverrides[group._id];
			yield put(GroupsActions.removeColorOverride([overridedGroup]));
		}
	} catch (error) {
		yield put(DialogActions.showErrorDialog('toggle', 'color override', error));
	}
}
开发者ID:3drepo,项目名称:3drepo.io,代码行数:15,代码来源:groups.sagas.ts


示例6: handleDevConfigLoaded

function* handleDevConfigLoaded() {
  const { 
    rootPath,
    context
  }: ExtensionState = yield select();

  const config =  workspace.getConfiguration("tandem.paperclip");

  const childServerPort = yield call(getPort);

  console.log(`spawning Paperclip dev server with env PORT ${childServerPort}`);

  console.log(JSON.stringify(config.devServer));

  let proc;

  const chan = eventChannel(emit => {
    proc = startPCDevServer({
      cwd: rootPath,
      pipeStdio: true,
      projectConfig: config.devServer,
      port: childServerPort
    }, emit);
    return () => {
      proc.dispose();
    };
  });

  yield spawn(function*() {
    while(1) {
      const action = yield take(chan);
      action[TAG] = 1;
      yield spawn(function*() {
        yield put(action);
      });
    }
  });

  yield spawn(function*() {
    while(1) {
      const action = yield take();
      if (action[TAG] || !action.$public) continue;
      proc.send(action);
    }
  });

  yield put(childDevServerStarted(childServerPort));
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:48,代码来源:dev-server.ts


示例7: handleDNDEnded

function* handleDNDEnded() {
  while(true) {
    const event = yield take(DND_ENDED);
    const state: ApplicationState = yield select();
    const workspace = getSelectedWorkspace(state);
    const dropRef = getStageToolMouseNodeTargetReference(state, event as DNDEvent);

    if (dropRef) {
      yield call(handleDroppedOnElement, dropRef, event);
    } else {
      yield call(handleDroppedOnEmptySpace, event);
    }

    yield put(dndHandled());
  }
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:16,代码来源:workspace.ts


示例8: handleDeleteKeyPressed

function* handleDeleteKeyPressed() {
  while(true) {
    const action = (yield take(DELETE_SHORCUT_PRESSED)) as DeleteShortcutPressed;
    const state = yield select();
    const { sourceEvent } = event as DeleteShortcutPressed;
    const workspace = getSelectedWorkspace(state);
    for (const [type, id] of workspace.selectionRefs) {
      yield put(workspaceSelectionDeleted(workspace.$id));
      yield put(removed(id, type as any));

      if (workspace.stage.fullScreen && workspace.stage.fullScreen.artboardId === id) {
        yield put(fullScreenTargetDeleted());
      }
    }
  }
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:16,代码来源:workspace.ts


示例9: fetchModelsPermissions

export function* fetchModelsPermissions({ models }) {
	try {
		const teamspace = yield select(selectCurrentTeamspace);
		let data = [];

		if (models.length) {
			const requiredModels = models.map(({ model }) => model);
			const response = yield API.fetchModelsPermissions(teamspace, requiredModels);
			data = response.data;
		}

		yield put(UserManagementActions.fetchModelPermissionsSuccess(data));
	} catch (error) {
		yield put(DialogActions.showEndpointErrorDialog('get', 'models/federations permissions', error));
	}
}
开发者ID:3drepo,项目名称:3drepo.io,代码行数:16,代码来源:userManagement.sagas.ts


示例10: refreshPostsDeal

export function* refreshPostsDeal(): any {
	while (true) {
		yield race({
			login: take(LOGIN_SUCCESS),
			addPost: take(ADD_WIKI_SPECPOST_SUCCESS),
			change: take(CHG_WIKI_SPECPOST_SUCCESS),
			delPost: take(DEL_WIKI_SPECPOST_SUCCESS),
		});

		// 触发查询
		yield put(queryPosts()); // 刷新文章

		const specTagId = yield select(getSpecTagId);
		yield put(querySpecTagPosts(specTagId)); // 刷新特定文章
	}
}
开发者ID:weiweiwitch,项目名称:third-lab,代码行数:16,代码来源:posts.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript effects.spawn函数代码示例发布时间:2022-05-25
下一篇:
TypeScript effects.race函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap