本文整理汇总了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 });
示例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 });
示例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 });
示例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 });
示例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 });
示例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 });
示例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 });
示例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 });