本文整理汇总了TypeScript中@ngxs/store.Selector函数的典型用法代码示例。如果您正苦于以下问题:TypeScript Selector函数的具体用法?TypeScript Selector怎么用?TypeScript Selector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Selector函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getCurrentTemplate
@Selector([SiteSettingsState.getCurrentSiteTemplate])
static getCurrentTemplate(state: SiteTemplatesStateModel, templateSlug: string) {
if (!templateSlug) {
return;
}
return state[templateSlug];
}
示例2: getLastError
@Selector()
static getLastError(state: ErrorStateModel[]) {
if (state.length === 0) {
return;
}
return state[state.length - 1];
}
示例3: roles
@Selector()
static roles(session: SessionStateModel) {
if (session.user) {
return session.user.roles;
} else {
return null;
}
}
示例4: getCurrentCurrency
@Selector([ShopSettingsState.getCurrentSiteSettings])
static getCurrentCurrency(_, currentSiteSettings) {
return currentSiteSettings
.find(group => {
return group.slug === 'group_config';
}).settings
.find(setting => setting.slug === 'currency').value || '';
}
示例5: getCurrentSiteSettings
@Selector([AppState.getSite])
static getCurrentSiteSettings(siteSettings: SitesSettingsStateModel, siteSlug: string) {
if (!siteSettings || siteSlug === null) {
return;
}
return siteSettings[siteSlug];
}
示例6: getCurrentTemplateSectionTypes
@Selector([SiteTemplatesState.getCurrentTemplate])
static getCurrentTemplateSectionTypes(_: SiteTemplatesStateModel, currentTemplate: TemplateSiteModel) {
if (!currentTemplate) {
return;
}
return currentTemplate.sectionTypes;
}
示例7: getCurrentTemplateConfig
@Selector([SiteTemplatesState.getCurrentTemplate])
static getCurrentTemplateConfig(_: SiteTemplatesStateModel, currentTemplate: TemplateSiteModel) {
if (!currentTemplate) {
return;
}
return currentTemplate.templateConf;
}
示例8: authorities
@Selector()
static authorities(session: SessionStateModel) {
if (session.user) {
return session.user.authorities;
} else {
return null;
}
}
示例9: getCurrentSiteLanguage
@Selector([SiteSettingsState.getCurrentSiteSettings])
static getCurrentSiteLanguage(_, currentSiteSettings): string | undefined {
if (!currentSiteSettings) {
return;
}
const languageSettings = currentSiteSettings.find(settingGroup => settingGroup.slug === 'language');
const language = languageSettings && languageSettings.settings.find(setting => setting.slug === 'language');
return language && language.value;
}
示例10: getCurrentSiteTemplate
@Selector([SiteSettingsState.getCurrentSiteSettings])
static getCurrentSiteTemplate(_, currentSiteSettings): string | undefined {
if (!currentSiteSettings) {
return;
}
const templateSettings = currentSiteSettings.find(settingGroup => settingGroup.slug === 'template');
const template = templateSettings && templateSettings.settings.find(setting => setting.slug === 'template');
return template && template.value;
}