DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
    • can-component
    • can-compute
    • can-connect
    • can-define
    • can-define/list/list
    • can-define/map/map
    • can-route
    • can-route-pushstate
    • can-set
    • can-stache
      • Pages
        • Magic Tag Types
        • Scope and Context
        • Expressions
        • Template Acquisition
        • Helpers
        • Live Binding
      • Methods
        • from
        • registerConverter
        • registerHelper
        • registerPartial
        • registerSimpleHelper
        • safeString
      • Tags
        • {{expression}}
        • {{{expression}}}
        • {{#expression}}
        • {{/expression}}
        • {{^expression}}
        • {{>key}}
        • {{!expression}}
        • {{else}}
      • Expressions
        • Bracket Expression
        • Call Expression
        • Hash Expression
        • Helper Expression
        • KeyLookup Expression
        • Literal Expression
      • Key Operators
        • @at
        • ~compute
        • ./current
        • ../parent
        • %special
        • this
        • *variable
        • key
      • Helpers
        • {{#if expression}}
        • {{#unless expression}}
        • {{#each expression}}
        • {{#with expression}}
        • {{log}}
        • {{#is expressions}}
        • {{#switch expression}}
        • {{#case expression}}
        • {{#default}}
        • {{joinBase expressions}}
      • Types
        • getterSetter
        • helper
        • helperOptions
        • renderer
        • sectionRenderer
        • simpleHelper
    • can-stache/helpers/route
    • can-stache-bindings
  • Ecosystem
  • Infrastructure
  • Legacy
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Core
  • /
  • can-stache
  • /
  • helperOptions
  • / On this page
    • helperOptions

      typedef

      The options argument passed to a helper function when called by a Helper Expression.

      • source

      Object

      When a helper function is called by a Helper Expression, a helperOptions object is passed with the following properties:

      stache.registerHelper("myHelper", function(helperOptions){
        helperOptions.fn      //-> sectionRenderer(){}
        helperOptions.inverse //-> sectionRenderer(){}
        helperOptions.hash    //-> Object
        helperOptions.context //-> *
        helperOptions.scope   //-> Scope
        helperOptions.option  //-> Scope.Options
      });
      

      Options

      • fn {sectionRenderer(context, helpers)}:

        Renders the "truthy" subsection BLOCK. options.fn is only available if the helper is called as a {{#expression}} or {{^expression}}. Read about section renderer for more information.

      • inverse {sectionRenderer(context, helpers)}:

        Renders the "falsey" subsection INVERSE. options.inverse is only available if the helper is called as a {{#expression}} or {{^expression}} and {{else}} is used. Read about section renderer for more information.

      • hash {Object}:

        An object containing all of the Hash expression keys and values. For example:

        {{helper arg1 arg2 name=value other=3 position="top"}}
        

        might provide a hash like:

        {
                name: compute("Mr. Pig"),
                other: 3,
                position: "top"
        }
        
      • context {*}:

        The current context the stache helper is called within. Read Scope and Context for more information.

      • scope {can-view-scope}:

        An object that represents the current context and all parent contexts. It can be used to look up key values in the current scope. Read Scope and Context and can-view-scope for more information.

      • options {Options}:

        It can be used to look up key values in the current options scope. Read Scope and Context and Options for more information.

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.