npm

npm’s 2019 JavaScript ecosystem survey analysis is now available!Get your copy here »

@adobe/cq-spa-component-mapping

1.0.3 • Public • Published

Table of contents

Installation

npm install @adobe/cq-spa-component-mapping

Usage

This module provides helpers to map resource types with SPA components.

MapTo

The MapTo helper can be used to directly associate resource type(s) with a given SPA component.

import { MapTo } from '@adobe/spa-component-mapping';

class MyComponent {
    ...
}

export default MapTo('my/resource/type')(MyComponent);

API

@adobe/cq-spa-component-mapping 1.0.3

src/ComponentMapping.js

new ComponentMapping()

ComponentMapping singleton. It manages the mapping between AEM component resource types and corresponding JavaScript component class.

Returns
  • Void

constructor()

Creates ComponentMapping singleton.

Returns
  • Void

map(resourceTypes, clazz)

Creates mapping for given resource type(s) and a component class.

Parameters
Name Type Description
resourceTypes string array - resource type(s)  
clazz object - component class that should be associated with given resource type(s)  
Returns
  • Void

get(resourceType)

Returns object (or undefined) matching with given resource type.

Parameters
Name Type Description
resourceType string - resource type  
Returns
  • object - class associated with given resource type

MapTo(resourceTypes)

Helper function that can be used to map a class to given resource type(s).

Parameters
Name Type Description
resourceTypes string array - resource type(s)  
Returns
  • function - function meant to map a class with the previously given resource types

src/utils/MapComponents.js

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.0.3 - 28 September 2018

  • Windows OS support
  • Server-Side Rendering support
  • Modularization

0.0.16 - 20 June 2018

Public release of cq-spa-component-mapping

0.0.15 - 20 April 2018

Initial public release of cq-spa-component-mapping, which provides:

  • MapTo helper to map JS components with AEM resource types
  • ComponentMapping singleton to interact with the existing mappings

install

npm i @adobe/cq-spa-component-mapping

Downloadsweekly downloads

517

version

1.0.3

license

Apache-2.0

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability