SAP Spartacus FeaturesConfig
源代码:
import { Injectable } from '@angular/core';
import { Config } from '../../config/config-tokens';@Injectable({providedIn: 'root',useExisting: Config,
})
export abstract class FeaturesConfig {features?: {[featureToggle: string]: string | boolean;};
}
FeatureConfig需要注入config-tokens里提供的Config.
Configuration injection token创建的factory方法:
而Configuration又依赖于DefaultConfiguration,因此需要先注入后者:
调用_currentInjector.get拿到DefaultConfigurationToken的实例。
_currentInjector的类型是R3Injector:
records字段里有注入好的实例:
this.records是一个map,首先检查传入的token是否已经在map里存在:
这个record里的属性很多:
感觉有很多module都使用了DefaultConfigurationChunk作为injection token
?
以这个cmsStoreConfigFactory工厂为例:cmsStoreConfigFactory
看个例子:
provideDefaultConfigFactory是一个helper function,接收另一个factory函数作为输入。
调用工厂函数获得value:
遍历这119条记录:
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
SAP Spartacus FeaturesConfig相关推荐
- SAP Spartacus ConfigurationService
位于文件configuration.service.ts内: import { Inject, Injectable, OnDestroy } from '@angular/core'; import ...
- SAP Spartacus 4.0 版本因为 hamburger 依赖导致构建出错的问题
build from Schematics 遇到错误消息: SassError: Undefined function. https://github.com/SAP/spartacus/issues ...
- SAP Spartacus UI 服务器端渲染的调试启动方式 - debug 模式
首先确认你已经熟悉这篇文章的启动方式:SAP Spartacus develop branch 的服务器端渲染启动方式. 第一步 添加一个新的 build script,把 --configurati ...
- SAP Spartacus Session affinity
参见这个讨论. 后端运行在多个 pods/节点时,当子序列请求过早进入时,后端将无法跨集群发送缓存失效请求.此外,如果多个请求分散在多个节点上,则会消耗延迟和不必要的资源. 对于单个客户端,Spart ...
- SAP Spartacus 4.0 的技术变化
在您迁移到 4.0 版库之前,我们强烈建议您切换到新的应用程序结构和新的功能库. 在多个小步骤中进行迁移更容易(迁移到新的应用程序结构,切换到提取的功能库,然后迁移到 4.0),您可以确保在每一步之后 ...
- SAP Spartacus travis ci-scripts 下面 e2e-cypress.sh 的实现分析
文件地址:https://github.com/SAP/spartacus/blob/develop/.travis.yml 里面引用到了 e2e-cypress.sh: https://github ...
- SAP Spartacus 里的 .release-it.json 文件
在 SAP Spartacus package.json 里有一个依赖叫做 release-it: 这个工具的链接:https://github.com/release-it/release-it 这 ...
- SAP Spartacus PageLayoutComponent 如何知道自己应该显示哪些具体内容
我们以前介绍过,经过 SAP Spartacus 路由配置后的 routes 数组,其 route 数据结构的 Component 属性,清一色指向 generic 的 PageLayoutCompo ...
- SAP Spartacus UI Duplicated keys has been found in the config of i18n chunks
在测试 SAP Spartacus 3.4.5 版本的 SSR 功能时,发现一个 warning 信息: console.warn(`Duplicated keys has been found in ...
最新文章
- linux 学习笔记 (五)
- 升级鸿蒙实例,华为鸿蒙 HarmonyOS 最新动作:上线 40+ 个 Sample 示例应用
- php yat grpc,Laravel 5 使用 Grpc 构建的微服务
- 51Nod 1007 正整数分组 | DP (01背包)
- Spring的bean管理注解和配置文件混合使用
- .NET 6新特性试用 | 热重载
- ASP.NET Core URL Rewrite中间件
- python抓取交易所_Python百行代码抓取美股三大交易所历史数据
- android 图片查看器
- Ubuntu16.04安装Unity3d2019.2.6
- 常用easyUI -icon 图标
- 树梅派学习 15. 语音合成软件使用
- wz框架登录功能详解——demo1
- foobar2000_备份Foobar2000并将其传输到新计算机
- [NodeJS] Mongoose Populate 基本使用
- IDEA敏感数据检测实践整理
- 机器学习(回归二)——线性回归-最小二乘-代码实现
- Windows电脑双屏设置不一样的壁纸
- 如何让企业员工不觉得知识库是个鸡肋,附带工具推荐
- arXiv每日推荐-5.5:计算机视觉/图像处理每日论文速递
热门文章
- c#中contextMenuStrip与datagridview使用CellMouseDown事件及treeview使用mousedown事件
- C++中如何去掉std::string对象的首尾空格
- C语言结构体实现类似C++的构造函数
- MySQL事务的介绍+事务的特性+事务的开启
- bzoj3144: [Hnoi2013]切糕(最小割)
- 【线段树 集合hash】bzoj4373: 算术天才⑨与等差数列
- [Go] 正则表达式 示例
- asp.net 字符串过滤
- flash 语法 入门
- sklearn自学指南(part15)--广义线性回归