API Docs for:
Show:

Template Class

Module: Core
Parent Module: JSFramework

Templating - Based off Simple JavaScript Templating by John Resig

Item Index

Methods

Properties

Methods

get

(
  • name
  • [data={}]
)
Function

Get a template

Parameters:

  • name String

    Name of the template

  • [data={}] Object optional

    Data to use in the template.

Returns:

Function: If data is specified, call template with data and return its HTML. If data is not specified, return the template itself.

parse

(
  • name
  • tmpl
)
Function

Parse a template, returning a JavaScript function to execute it. Also caches the template in case it's used later

Parameters:

  • name String

    Name of the template, used to cache it

  • tmpl String

    Template code

Returns:

Function: JavaScript function for executing the template

Properties

cache

Object private

Cache of all parsed templates