@adobe/cq-spa-page-model-manager

中文文档
1.1.7发布于 2020/08/31Apache-2.0TypeScriptCommonJS近 30 天下载 5171
此软件包已被标记为弃用

Package has been renamed. Please use @adobe/aem-spa-page-model-manager

原始使用文档
文档目录22 节
  1. Installation
  2. Usage
  3. API
  4. @adobe/cq-spa-page-model-manager 1.1.7
  5. Documentation
  6. Changelog
  7. 1.1.5 - 24 August 2020
  8. 1.1.4 - 24 August 2020
  9. 1.1.3 - 5 June 2020
  10. 1.1.2 - 19 May 2020
  11. 1.1.1 - 17 January 2020
  12. 1.1.0 - 19 December 2019
  13. 1.0.7 - 4 April 2019
  14. 1.0.6 - 6 March 2019
  15. 1.0.5 - 12 December 2018
  16. 1.0.4 - 9 November 2018
  17. 1.0.3 - 11 October 2018
  18. 1.0.1 - 28 September 2018
  19. Removed
  20. 0.0.24 - 22 June 2018
  21. 0.0.23 - 15 May 2018
  22. 0.0.22 - 20 April 2018

Table of contents

The package is deprecated

The package has been moved. Please use @adobe/aem-spa-model-manager

Installation

npm install @adobe/cq-spa-page-model-manager

Usage

This module provides the API to manage the model representation of the pages that are composing a SPA.

// index.html

<head>
...
    <meta property="cq:pagemodel_root_url" content="... .model.json"/>
...
</head>
...

// Bootstrap: index.js
import { ModelManager } from '@adobe/cq-spa-page-model-manager';

ModelManager.initialize().then((model) => {
    // Render the App content using the provided model
    render(model);
});

// Loading a specific portion of model
ModelManager.getData("/content/site/page/jcr:content/path/to/component").then(...); 

API

@adobe/cq-spa-page-model-manager 1.1.7

Documentation

The technical documentation is already available, but if you are unable to solve your problem or you found a bug you can always contact us and ask for help!

Changelog

1.1.5 - 24 August 2020

1.1.4 - 24 August 2020

1.1.3 - 5 June 2020

  • Support Launches content paths

1.1.2 - 19 May 2020

  • Do not fetch excluded routes on model manager initialization

1.1.1 - 17 January 2020

  • Fixed:
    • Page crashes on link containing query parameter without html extension

1.1.0 - 19 December 2019

  • Improve URL sanitizing behavior for model.json requests
  • Make clone a dependency instead of a peer dependency
  • Remove optional dependencies

1.0.7 - 4 April 2019

  • no functional changes

1.0.6 - 6 March 2019

  • ModelManager#initialze to consistently return the same type of object
  • ModelManager#initialze to fire a cq-pagemodel-loaded event

1.0.5 - 12 December 2018

  • ModelClient fetch: added default credentials for the request

1.0.4 - 9 November 2018

  • support path ending the jcr:content when getting the data from the ModelStore

1.0.3 - 11 October 2018

  • Un-found remote model entry point rejection handling
  • README update

1.0.1 - 28 September 2018

  • BREAKING CHANGE API refactoring for a better modularization
  • BREAKING CHANGE SSR refactoring
    • Added support for setting apiHost, in order to force absolute url requests on Node server
    • Added support for initializing with an existing model. This is useful when we initialize in the client, the state from the server.
    • Guarding for dispatching & listening events only in browser context.
    • Fixed race conditions with init method when called from getData

Removed

  • unnecessary and misleading event triggering resulting in the Page Editor not to have overlays

0.0.24 - 22 June 2018

Public release of cq-spa-page-model-manager, which provides:

  • support for context path
  • BREAKING CHANGE change routing method to support History API by default (hash routing support has been removed)

0.0.23 - 15 May 2018

Public release of cq-spa-page-model-manager, which provides:

  • Support for the latest version of the com.adobe.cq.export.json.hierarchy API
    • Support and usage of the :path and :children fields to identify a page and its child pages
  • Support for URLs containing a context path
    • The PageModelManager can now be used in conjunction with URLs including a context path

0.0.22 - 20 April 2018

Initial public release of cq-spa-page-model-manager, which provides:

  • Updated PageModelManager API, now able to manage the model of multiple pages stored in AEM:
    • getData(), addListeners() and removeListeners() expect a config parameter that specifies the pagePath and dataPath
    • getData() supports a forceReload parameter
    • cq-pagemodel-update event listener expects pagePath and dataPath in the event data object
  • New ModelRouter, which reacts to hash changes and triggers the reload of the corresponding model asynchronously
    • cq-pagemodel-route-changed event indicates route changes after successful model update

版本与发布记录

@adobe/cq-spa-page-model-manager 共发布 28 个版本,首次发布于 2018/04/17;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.7latest2020/08/316 年前
1.1.62020/08/256 年前
1.1.52020/08/246 年前
1.1.42020/08/246 年前
1.2.02020/08/206 年前
1.1.32020/06/066 年前

其他发布通道:internal → 0.0.23,beta → 0.0.25-beta.1。

关于 @adobe/cq-spa-page-model-manager 的常见问题

@adobe/cq-spa-page-model-manager 是什么?

Installation * Usage * API * Documentation * Changelog注意:该包已被作者标记为弃用——Package has been renamed. Please use @adobe/aem-spa-page-model-manager

如何安装 @adobe/cq-spa-page-model-manager?

在项目目录运行 npm install @adobe/cq-spa-page-model-manager,或使用 pnpm add / yarn add / bun add。

@adobe/cq-spa-page-model-manager 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@adobe/cq-spa-page-model-manager 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@adobe/cq-spa-page-model-manager 可以商用吗?

@adobe/cq-spa-page-model-manager 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@adobe/cq-spa-page-model-manager 的下载量有多少?

根据 npm 官方下载统计,@adobe/cq-spa-page-model-manager 在 2026/10/05 – 2026/11/03 这 30 天内被下载 5,171 次,日均约 172 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adobe/cq-spa-page-model-manager 还在维护吗?

最新版本 1.1.7 发布于 2020/08/31(6 年前);至今共发布 28 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/04/17。作者已将其标记为弃用,新项目建议寻找替代方案。