Class: CMS

CMS~CMS()

Represents a CMS instance

Constructor

new CMS()

Source:

Members

collections

Properties:
Name Type Description
FileCollection[
Source:

Methods

fetchLayout(layout, data) → {Promise.<string>}

Pass-thru convenience function for external scripts to utilize the template engine

Parameters:
Name Type Description
layout string
data Object
Source:
Returns:
Type
Promise.<string>

getCollection(name) → {FileCollection|null}

Get the given collection either by name or NULL if it does not exist

Parameters:
Name Type Description
name string
Source:
Returns:
Type
FileCollection | null

getPathsFromURL() → {Array.<string>}

Retrieve the current path URL broken down into individual pieces

Source:
Returns:

The segments of the URL broken down by directory

Type
Array.<string>

historyPushState(url)

PUSH the window location, useful for most interactions where the user may click 'back'

This is the normal "go to URL" method for the CMS.

Parameters:
Name Type Description
url string
Source:

historyReplaceState(url)

REPLACE the window location, ONLY really useful on initial pageload

Use historyPushState instead for most interactions where the user may click 'back'

Parameters:
Name Type Description
url string

URL to replace

Source:

init()

Init

Initializes the application based on the configuration. Sets up config object, hash change event listener for router, and loads the content.

Source:

(async) initFileCollections() → {Promise}

Initialize file collections

Source:
Returns:
Type
Promise

isExtraLoaded(extra) → {boolean}

Check if the requested extra is loaded

Parameters:
Name Type Description
extra string
Source:
Returns:
Type
boolean

listenerLinkClick(e)

Handle processing links clicked, will re-route to the history for applicable links.

Parameters:
Name Type Description
e MouseEvent

Click event from user

Source:

load(optionsopt)

Set the options for the CMS and initialize the system

Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

List of config options

Source:

(async) loadExtra(extra, optionsopt) → {Promise.<string>}

Load an extra / plugin, optionally with plugin configuration options

Parameters:
Name Type Attributes Default Description
extra string

Plugin name to load

options Object | null <optional>
null

Configuration options for the plugin

Source:
Returns:

Resolves with the plugin name if loaded successfully

Type
Promise.<string>

renderLayout(layout, data) → {Promise}

Renders a layout with the set data

Parameters:
Name Type Description
layout string

Base filename of layout to render

data TemplateObject

Data passed to template.

Source:
Returns:

Returns rendered HTML on success or the error message on error

Type
Promise

route()

Primary method handling the loading of pages and content within the CMS

Source:

Search method for file collections.

Parameters:
Name Type Description
type string

Type of file collection.

search string

Search query.

Source:

sort(type, sort)

Sort method for file collections.

Parameters:
Name Type Description
type string

Type of file collection.

sort function

Sorting function.

Source: