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


TypeScript StoreInjector.StoreContainer函数代码示例

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


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

示例1: getProperties

import { Store } from '@dojo/framework/stores/Store';
import { Feeds, FeedsProperties } from './../widgets/Feeds';
import { fetchFeedProcess, favoriteFeedArticleProcess } from './../processes/feedProcesses';

import { State } from './../interfaces';
import { StoreContainer } from '@dojo/framework/stores/StoreInjector';

function getProperties(store: Store<State>, properties: FeedsProperties): FeedsProperties {
	const { get, path } = store;
	const loading = get(path('feed', 'loading'));
	const isAuthenticated = !!get(path('user', 'token'));
	const username = properties.username || get(path('user', 'username'));
	const defaultType = isAuthenticated ? 'feed' : 'global';
	const type = properties.type ? properties.type : get(path('feed', 'category')) || defaultType;

	return {
		items: get(path('feed', 'items')),
		type,
		loading,
		username,
		isAuthenticated,
		tagName: get(path('feed', 'tagName')),
		total: get(path('feed', 'total')),
		currentPage: get(path('feed', 'pageNumber')),
		fetchFeed: fetchFeedProcess(store),
		favoriteArticle: favoriteFeedArticleProcess(store)
	};
}

export default StoreContainer(Feeds, 'state', { paths: [['feed']], getProperties });
开发者ID:dojo,项目名称:examples,代码行数:30,代码来源:FeedsContainer.ts

示例2: getProperties

import { Store } from '@dojo/framework/stores/Store';
import { Header, HeaderProperties } from './../widgets/Header';
import { State } from '../interfaces';
import { StoreContainer } from '@dojo/framework/stores/StoreInjector';

function getProperties(store: Store<State>): HeaderProperties {
	const { get, path } = store;

	return {
		isAuthenticated: !!get(path('user', 'token')),
		loggedInUser: get(path('user', 'username'))
	};
}

export default StoreContainer(Header, 'state', { paths: [['user']], getProperties });
开发者ID:dojo,项目名称:examples,代码行数:15,代码来源:HeaderContainer.ts

示例3: getProperties

	descInputProcess,
	removeTagProcess,
	tagInputProcess,
	titleInputProcess
} from './../processes/editorProcesses';
import { State } from '../interfaces';
import { StoreContainer } from '@dojo/framework/stores/StoreInjector';

function getProperties(store: Store<State>, properties: EditorProperties): EditorProperties {
	const { get, path } = store;

	return {
		title: get(path('editor', 'title')),
		description: get(path('editor', 'description')),
		body: get(path('editor', 'body')),
		tag: get(path('editor', 'tag')),
		tags: get(path('editor', 'tagList')),
		errors: get(path('errors')),
		onContentInput: bodyInputProcess(store),
		onDescriptionInput: descInputProcess(store),
		onTagCreate: addTagProcess(store),
		onTagDelete: removeTagProcess(store),
		onTagInput: tagInputProcess(store),
		onTitleInput: titleInputProcess(store),
		onPublishPost: publishArticleProcess(store),
		slug: properties.slug
	};
}

export default StoreContainer(Editor, 'state', { paths: [['editor'], ['errors']], getProperties });
开发者ID:dojo,项目名称:examples,代码行数:30,代码来源:EditorContainer.ts

示例4: getProperties

import { Store } from '@dojo/framework/stores/Store';
import { Tags, TagsProperties } from './../widgets/Tags';
import { fetchFeedProcess } from '../processes/feedProcesses';
import { State } from '../interfaces';
import { StoreContainer } from '@dojo/framework/stores/StoreInjector';

function getProperties(store: Store<State>): TagsProperties {
	const { get, path } = store;
	return {
		tags: get(path('tags')) || [],
		fetchFeed: fetchFeedProcess(store)
	};
}

export default StoreContainer(Tags, 'state', { paths: [['tags']], getProperties });
开发者ID:dojo,项目名称:examples,代码行数:15,代码来源:TagsContainer.ts

示例5: getProperties

import { Store } from '@dojo/framework/stores/Store';
import { Login, LoginProperties } from './../widgets/Login';
import { loginProcess, loginEmailInputProcess, loginPasswordInputProcess } from './../processes/loginProcesses';
import { State } from '../interfaces';
import { StoreContainer } from '@dojo/framework/stores/StoreInjector';

function getProperties(store: Store<State>): LoginProperties {
	const { get, path } = store;

	return {
		email: get(path('login', 'email')),
		password: get(path('login', 'password')),
		errors: get(path('errors')),
		inProgress: get(path('login', 'loading')),
		onEmailInput: loginEmailInputProcess(store),
		onPasswordInput: loginPasswordInputProcess(store),
		onLogin: loginProcess(store)
	};
}

export default StoreContainer(Login, 'state', { paths: [['login'], ['errors']], getProperties });
开发者ID:dojo,项目名称:examples,代码行数:21,代码来源:LoginContainer.ts

示例6: getProperties

import { Store } from '@dojo/framework/stores/Store';
import { Register, RegisterProperties } from './../widgets/Register';
import {
	registerProcess,
	registerEmailInputProcess,
	registerPasswordInputProcess,
	registerUsernameInputProcess
} from './../processes/loginProcesses';
import { State } from '../interfaces';
import { StoreContainer } from '@dojo/framework/stores/StoreInjector';

function getProperties(store: Store<State>): RegisterProperties {
	const { get, path } = store;

	return {
		email: get(path('register', 'email')),
		password: get(path('register', 'password')),
		username: get(path('register', 'username')),
		errors: get(path('errors')),
		inProgress: get(path('register', 'loading')),
		onEmailInput: registerEmailInputProcess(store),
		onPasswordInput: registerPasswordInputProcess(store),
		onUsernameInput: registerUsernameInputProcess(store),
		onRegister: registerProcess(store)
	};
}

export default StoreContainer(Register, 'state', { paths: [['register'], ['errors']], getProperties });
开发者ID:dojo,项目名称:examples,代码行数:28,代码来源:RegisterContainer.ts

示例7: getProperties

	favoriteArticleProcess,
	followUserProcess,
	deleteArticleProcess
} from './../processes/articleProcesses';
import { State } from '../interfaces';
import { StoreContainer } from '@dojo/framework/stores/StoreInjector';

function getProperties(store: Store<State>, properties: ArticleProperties): ArticleProperties {
	const { get, path } = store;

	return {
		article: get(path('article', 'item')),
		authorProfile: get(path('article', 'item', 'author')),
		comments: get(path('article', 'comments')) || [],
		newComment: get(path('article', 'newComment')),
		loaded: get(path('article', 'loaded')),
		isAuthenticated: !!get(path('user', 'token')),
		loggedInUser: get(path('user', 'username')),
		username: get(path('user', 'username')),
		slug: properties.slug,
		deleteComment: deleteCommentProcess(store),
		addComment: addCommentProcess(store),
		onNewCommentInput: newCommentInputProcess(store),
		favoriteArticle: favoriteArticleProcess(store),
		followUser: followUserProcess(store),
		deleteArticle: deleteArticleProcess(store)
	};
}

export default StoreContainer(Article, 'state', { paths: [['user'], ['article']], getProperties });
开发者ID:dojo,项目名称:examples,代码行数:30,代码来源:ArticleContainer.ts

示例8: getProperties

	emailInputProcess,
	passwordInputProcess,
	imageUrlInputProcess,
	usernameInputProcess,
	updateUserSettingsProcess
} from './../processes/settingsProcesses';
import { logoutProcess } from '../processes/loginProcesses';
import { State } from '../interfaces';
import { StoreContainer } from '@dojo/framework/stores/StoreInjector';

function getProperties(store: Store<State>): SettingsProperties {
	const { get, path } = store;

	return {
		email: get(path('settings', 'email')),
		password: get(path('settings', 'password')),
		username: get(path('settings', 'username')),
		imageUrl: get(path('settings', 'image')),
		bio: get(path('settings', 'bio')),
		onEmailInput: emailInputProcess(store),
		onPasswordInput: passwordInputProcess(store),
		onUsernameInput: usernameInputProcess(store),
		onBioInput: bioInputProcess(store),
		onImageUrlInput: imageUrlInputProcess(store),
		onUpdateSettings: updateUserSettingsProcess(store),
		logout: logoutProcess(store)
	};
}

export default StoreContainer(Settings, 'state', { paths: [['settings']], getProperties });
开发者ID:dojo,项目名称:examples,代码行数:30,代码来源:SettingsContainer.ts


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