Sha256: 8c30686937fd5275d8e8e3952bcbbec0c36f345cc183aba5cb54f46112443ab4

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

/**
@module ember
*/
/**
    The `let` helper receives one or more positional arguments and yields
    them out as block params.

    This allows the developer to introduce shorter names for certain computations
    in the template.

    This is especially useful if you are passing properties to a component
    that receives a lot of options and you want to clean up the invocation.

    For the following example, the template receives a `post` object with
    `content` and `title` properties.

    We are going to call the `my-post` component, passing a title which is
    the title of the post suffixed with the name of the blog, the content
    of the post, and a series of options defined in-place.

    ```handlebars
    {{#let
        (concat post.title ' | The Ember.js Blog')
        post.content
        (hash
          theme="high-contrast"
          enableComments=true
        )
        as |title content options|
    }}
      {{my-post title=title content=content options=options}}
    {{/let}}
  ```

  @method let
  @for Ember.Templates.helpers
  @public
*/
export function blockLetMacro(params, _hash, template, _inverse, builder) {
    if (template !== null) {
        if (params !== null) {
            builder.compileParams(params);
            builder.invokeStaticBlock(template, params.length);
        }
        else {
            builder.invokeStatic(template);
        }
    }
    return true;
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/@ember/-internals/glimmer/lib/syntax/let.js
discourse-ember-source-3.5.1.1 dist/es/ember-glimmer/lib/syntax/let.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-glimmer/lib/syntax/let.js