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

TypeScript Container.Container函数代码示例

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

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



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

示例1: getProperties

import { Container } from '@dojo/widget-core/Container';
import { Store } from '@dojo/stores/Store';
import { Register, RegisterProperties } from './../widgets/Register';
import {
	registerProcess,
	registerEmailInputProcess,
	registerPasswordInputProcess,
	registerUsernameInputProcess
} from './../processes/loginProcesses';
import { State } from '../interfaces';

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 const RegisterContainer = Container(Register, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:28,代码来源:RegisterContainer.ts


示例2: getProperties

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

import { State } from './../interfaces';

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 const FeedsContainer = Container(Feeds, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:30,代码来源:FeedsContainer.ts


示例3: getProperties

import { Container } from '@dojo/widget-core/Container';
import { Store } from '@dojo/stores/Store';
import { Header, HeaderProperties } from './../widgets/Header';
import { State } from '../interfaces';

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

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

export const HeaderContainer = Container(Header, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:16,代码来源:HeaderContainer.ts


示例4: getProperties

import { Container } from '@dojo/widget-core/Container';
import Store from '@dojo/stores/Store';

import { TodoDetails } from './../widgets/TodoDetails';
import {
	editTodoProcess,
	saveTodoProcess,
	TodoStore
} from './../todoProcesses';

function getProperties(store: Store<TodoStore>, properties: any) {
	const { get, path } = store;
	return {
		todo: get(path('editedTodo')) || get(path('todos', properties.id)),
		editTodo: editTodoProcess(store),
		saveTodo: saveTodoProcess(store)
	};
}

export const TodoDetailsContainer = Container(TodoDetails, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:20,代码来源:TodoDetailsContainer.ts


示例5: getProperties

	setCurrentTodoProcess,
	searchProcess,
	clearCompletedProcess,
	toggleTodoProcess,
	toggleTodosProcess,
	removeTodoProcess,
	TodoStore
} from '../todoProcesses';

function getProperties(store: Store<TodoStore>) {
	const { get, path } = store;
	return {
		todos: Object.keys(get(path('todos'))).map(key => get(path('todos', key))),
		currentTodo: get(path('currentTodo')),
		addTodo: addTodoProcess(store),
		editTodo: editTodoProcess(store),
		setCurrentTodo: setCurrentTodoProcess(store),
		search: searchProcess(store),
		searchValue: get(path('currentSearch')),
		completed: get(path('completed')),
		clearCompleted: clearCompletedProcess(store),
		toggleTodos: toggleTodosProcess(store),
		toggleTodo: toggleTodoProcess(store),
		activeCount: get(path('todoCount')) - get(path('completedCount')),
		todoCount: get(path('todoCount')),
		removeTodo: removeTodoProcess(store)
	};
}

export const TodoAppContainer = Container(TodoApp, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:30,代码来源:TodoAppContainer.ts


示例6: getProperties

import { Container } from '@dojo/widget-core/Container';
import { Store } from '@dojo/stores/Store';
import { Tags, TagsProperties } from './../widgets/Tags';
import { fetchFeedProcess } from '../processes/feedProcesses';
import { State } from '../interfaces';

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

export const TagsContainer = Container(Tags, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:15,代码来源:TagsContainer.ts


示例7: getProperties

import { Container } from '@dojo/widget-core/Container';
import { Store } from '@dojo/stores/Store';
import { Profile, ProfileProperties } from './../widgets/Profile';
import { State } from '../interfaces';
import { followUserProcess } from './../processes/profileProcesses';

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

	return {
		username: properties.username,
		type: properties.type,
		image: get(path('profile', 'image')),
		bio: get(path('profile', 'bio')),
		following: get(path('profile', 'following')),
		currentUser: get(path('user', 'username')),
		followUser: followUserProcess(store)
	};
}

export const ProfileContainer = Container(Profile, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:21,代码来源:ProfileContainer.ts


示例8: getProperties

import { Container } from '@dojo/widget-core/Container';
import { Store } from '@dojo/stores/Store';
import { Login, LoginProperties } from './../widgets/Login';
import { loginProcess, loginEmailInputProcess, loginPasswordInputProcess } from './../processes/loginProcesses';
import { State } from '../interfaces';

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 const LoginContainer = Container(Login, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:21,代码来源:LoginContainer.ts


示例9: getProperties

	bioInputProcess,
	emailInputProcess,
	passwordInputProcess,
	imageUrlInputProcess,
	usernameInputProcess,
	updateUserSettingsProcess
} from './../processes/settingsProcesses';
import { logoutProcess } from '../processes/loginProcesses';
import { State } from '../interfaces';

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 const SettingsContainer = Container(Settings, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:30,代码来源:SettingsContainer.ts


示例10: getProperties

import { Container } from '@dojo/widget-core/Container';
import Injector from '@dojo/widget-core/Injector';
import { switchLocale } from '@dojo/i18n/i18n';

import { ThemeSwitcher } from './../widgets/ThemeSwitcher';
import pirateThemeStyles from './../themes/pirate';

function getProperties(themeContext: Injector) {
	return {
		changeTheme(wantsPirate: boolean) {
			if (wantsPirate) {
				switchLocale('en-PR');
				themeContext.set(pirateThemeStyles);
			}
			else {
				switchLocale('en');
				themeContext.set(undefined);
			}
		}
	};
}

export const ThemeSwitcherContainer = Container(ThemeSwitcher, 'theme-context', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:23,代码来源:ThemeSwitcherContainer.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript createWidgetBase.mixin函数代码示例发布时间:2022-05-28
下一篇:
TypeScript d.assignProperties函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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