以product name normalizer为例:
路径:C:\Code\SPA\spartacus\projects\core\src\occ\adapters\product\converters\product-name-normalizer.ts
拷贝下类的名称:
ProductNameNormalizer
如果想运行时调试,在Spartacus-core.js里,根据这个名称搜索,找到对应的JavaScript function:ProductNameNormalizer_Factory:
/**
* Construct an `InjectableDef` which defines how a token will be constructed by the DI system, and
* in which injectors (if any) it will be available.
*
* This should be assigned to a static `ɵprov` field on a type, which will then be an
* `InjectableType`.
*
* Options:
* * `providedIn` determines which injectors will include the injectable, by either associating it
* with an `@NgModule` or other `InjectorType`, or by specifying that this injectable should be
* provided in the `'root'` injector, which will be the application-level injector in most apps.
* * `factory` gives the zero argument function which will create an instance of the injectable.
* The factory can call `inject` to access the `Injector` and request injection of dependencies.
*
* @codeGenApi
*/
function ɵɵdefineInjectable(opts) {
return {
token: opts.token,
providedIn: opts.providedIn || null,
factory: opts.factory,
value: undefined,
};
}
随着构造函数一起传进来的配置对象:
这个配置对象的赋值是通过eeinject(OccConfig)进行的:
converter调用的地方:Pipeable operator to apply converter logic in a observable stream
convertSource(source, injectionToken) {
return this.getConverters(injectionToken).reduce((target, converter) => {
return converter.convert(source, target);
}, undefined);
}
向Commerce Cloud后台发起请求:
得到完整的occ地址:
网友评论