Skip to main content
Version: 2.2.0

ViewEngine – durandal/viewEngine

caution

The interface documentation for this module is incomplete. Declarations may be missing or invalid.

Variables​

cache (internal)​

cache

viewExtension​

viewExtension: string = '.html'

The file extension that view source files are expected to have.

viewPlugin​

viewPlugin: string = 'text'

The name of the RequireJS loader plugin used by the viewLocator to obtain the view source. (Use requirejs to map the plugin's full path).

viewPluginParameters​

viewPluginParameters: string = ''

Parameters passed to the RequireJS loader plugin used by the viewLocator to obtain the view source.

  • default – The empty string by default.

Functions​

isViewUrl​

isViewUrl(url: string): boolean

Determines if the url is a url for a view, according to the view engine.

  • (param) url – The potential view url.
  • returns – True if the url is a view url, false otherwise.

convertViewUrlToViewId​

convertViewUrlToViewId(url: string): string

Converts a view url into a view id.

  • (param) viewId – The view id to convert.
  • returns – The require path.

convertViewIdToRequirePath​

convertViewIdToRequirePath(viewId: string): string

Converts a view id into a full RequireJS path.

  • (param) viewId – The view id to convert.
  • returns – The require path.

parseMarkup​

parseMarkup(markup: string): Element[]

Parses the view engine recognized markup and returns DOM elements.

  • (param) markup – The markup to parse.
  • returns – The elements.

processMarkup​

processMarkup(markup: string): Element

Calls parseMarkup and then pipes the results through ensureSingleElement.

  • (param) markup – The markup to process.
  • returns – The view.

ensureSingleElement​

ensureSingleElement(allElements: Element[]): Element

Converts an array of elements into a single element. White space and comments are removed. If a single element does not remain, then the elements are wrapped.

  • (param) allElements – The elements.
  • returns – A single element.

tryGetViewFromCache​

tryGetViewFromCache()