SAP Spartacus ProductConnector和ProductService实现
名称:ProductConnector
路径:在core文件夹下
通过ProductAdapter向Commerce Cloud发起数据请求:
逻辑很简单,直接调用adapter的load方法。
什么时候ProductConnector会被调用?
let ProductEffects = class ProductEffects {constructor(actions$, productConnector) {this.actions$ = actions$;this.productConnector = productConnector;// we want to cancel all ongoing requests when currency or language changes,this.contextChange$ = this.actions$.pipe(ofType(CURRENCY_CHANGE, LANGUAGE_CHANGE));this.loadProduct$ = createEffect(() => ({ scheduler, debounce = 0 } = {}) => this.actions$.pipe(ofType(LOAD_PRODUCT), map((action) => ({code: action.payload,scope: action.meta.scope,})), // we are grouping all load actions that happens at the same time// to optimize loading and pass them all to productConnector.getManybufferDebounceTime(debounce, scheduler), mergeMap((products) => merge(...this.productConnector.getMany(products).map(this.productLoadEffect))), withdrawOn(this.contextChange$)));}
有17个product需要加载:
loadProduct$的实现,包含了加载多个product的逻辑:
这17个product是外层传进来的:
看这个getProductForScope是何时被调用的:
又出现了一个ProductService:
位于facade层:
Spartacus-storefront.js:
这个ProductCarouselComponent位于storefrontlib文件夹内:
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
SAP Spartacus ProductConnector和ProductService实现相关推荐
- 如何在SAP Spartacus category 页面里拿到当前的category信息
需求 https://stackoverflow.com/questions/59950572/how-to-access-the-current-categorydata-in-a-category ...
- 使用 outlet 在SAP Spartacus 的页面添加自定义 HTML 元素的一个例子
需求:在SAP Spartacus的home page如下区域,显示硬编码的Hot sale标题: 创建一个新的Component,其中hotProduct$的值填充成硬编码的id为816780的产品 ...
- SAP Spartacus 的基于outlet 的页面扩展
outlet 是 SAP Spartacus 提供 partners 一种将 custom UI 插入 Spartacus 标准 DOM 的一种手段. outlets get added for ea ...
- 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 这 ...
最新文章
- 那些巨头公司的前端面试都喜欢问些什么?
- Tomcat windows下安装
- Android标题栏,状态栏
- 【MySQL】玩转定时器
- 欧拉函数 - HDU1286
- 历时7周,当然了真正的安装时间没这么多,终于把集群安装好了
- python静态变量和静态方法_python的静态成员变量、实例成员变量、静态方法、类方法、实例方法...
- C# TCP 相关类与方法
- 话说模式匹配(5) for表达式中的模式匹配
- 腾讯围棋AI绝艺战胜DeepZenGo又夺一冠
- AcWing 848. 有向图的拓扑序列(拓扑排序模板)
- ---Ubuntu 下安装oracle Java
- 屏蔽网页所有弹出广告的神器工具!Adblock插件
- 超好用的网站克隆工具,就是玩
- python实现手机通讯录_Python 实现简单的电话本功能
- css3探测光圈_纯CSS3实现的镜头光晕(光圈)
- android开发 自定义锁屏界面,插件锁屏桌面自定义 “安卓4.0”界面美化教程
- [9i] 猪年说猪,属相,本命年,十二生肖用英语该怎么说
- 使用PEAP实现802.1X
- “3D游戏之父”手游考古,网友:求支持智能手机!