mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Docs changes for 0.8.3
This commit is contained in:
@@ -2189,6 +2189,12 @@ This property provides access to the data context at the top level of
|
||||
the template. It is updated each time the template is re-rendered.
|
||||
Access is read-only and non-reactive.
|
||||
|
||||
{{> api_box template_autorun}}
|
||||
|
||||
You can use `this.autorun` from a [`created`](#template_created) or
|
||||
[`rendered`](#template_rendered) callback to reactively update the DOM
|
||||
or the template instance. The Computation is automatically stopped
|
||||
when the template is destroyed.
|
||||
|
||||
<h2 id="ui"><span>Template utilities</span></h2>
|
||||
|
||||
@@ -2205,6 +2211,15 @@ any part of the DOM for finer control than just using template inclusions.
|
||||
You can define helpers and event maps on `UI.body` just like on any
|
||||
`Template.myTemplate` object.
|
||||
|
||||
Helpers on `UI.body` are only available in the `<body>` tags of your
|
||||
app. To register a global helper, use
|
||||
[UI.registerHelper](#ui_registerhelper).
|
||||
|
||||
Event maps on `UI.body` don't apply to elements added to the body via
|
||||
`UI.insert`, jQuery, or the DOM API, or to the body element itself.
|
||||
To handle events on the body, window, or document, use jQuery or the
|
||||
DOM API.
|
||||
|
||||
{{> api_box ui_render}}
|
||||
|
||||
This returns an "rendered template" object, which can be passed to
|
||||
@@ -2238,7 +2253,15 @@ changes.
|
||||
|
||||
{{> api_box ui_getelementdata}}
|
||||
|
||||
{{> api_box ui_dynamic}}
|
||||
|
||||
`UI.dynamic` allows you to include a template by name, where the name
|
||||
may be calculated by a helper and may change reactively. The `data`
|
||||
argument is optional, and if it is omitted, the current data context
|
||||
is used.
|
||||
|
||||
For example, if there is a template named "foo", `{{dstache}}> UI.dynamic
|
||||
template="foo"}}` is equivalent to `{{dstache}}> foo}}`.
|
||||
|
||||
{{#api_box eventmaps}}
|
||||
|
||||
|
||||
@@ -1845,6 +1845,17 @@ Template.api.template_data = {
|
||||
descr: ["The data context of this instance's latest invocation."]
|
||||
};
|
||||
|
||||
Template.api.template_autorun = {
|
||||
id: "template_autorun",
|
||||
name: "<em>this</em>.autorun(runFunc)",
|
||||
locus: "Client",
|
||||
descr: ["A version of [Deps.autorun](#deps_autorun) that is stopped when the template is destroyed."],
|
||||
args: [
|
||||
{name: "runFunc",
|
||||
type: "Function",
|
||||
descr: "The function to run. It receives one argument: a Deps.Computation object."}
|
||||
]
|
||||
};
|
||||
|
||||
Template.api.ui_registerhelper = {
|
||||
id: "ui_registerhelper",
|
||||
@@ -1862,6 +1873,22 @@ Template.api.ui_registerhelper = {
|
||||
}]
|
||||
};
|
||||
|
||||
Template.api.ui_dynamic = {
|
||||
id: "ui_dynamic",
|
||||
name: "{{> UI.dynamic template=templateName [data=dataContext]}}",
|
||||
locus: "Client",
|
||||
descr: ["Choose a template to include dynamically, by name."],
|
||||
args: [
|
||||
{name: "templateName",
|
||||
type: "String",
|
||||
descr: "The name of the template to include."
|
||||
},
|
||||
{name: "dataContext",
|
||||
type: "Object",
|
||||
descr: "Optional. The data context in which to include the template."
|
||||
}]
|
||||
};
|
||||
|
||||
Template.api.ui_body = {
|
||||
id: "ui_body",
|
||||
name: "UI.body",
|
||||
|
||||
@@ -253,7 +253,8 @@ var toc = [
|
||||
{instance: "this", name: "find", id: "template_find"},
|
||||
{instance: "this", name: "firstNode", id: "template_firstNode"},
|
||||
{instance: "this", name: "lastNode", id: "template_lastNode"},
|
||||
{instance: "this", name: "data", id: "template_data"}
|
||||
{instance: "this", name: "data", id: "template_data"},
|
||||
{instance: "this", name: "autorun", id: "template_autorun"}
|
||||
],
|
||||
"UI", [
|
||||
"UI.registerHelper",
|
||||
@@ -262,7 +263,8 @@ var toc = [
|
||||
"UI.renderWithData",
|
||||
"UI.insert",
|
||||
"UI.remove",
|
||||
"UI.getElementData"
|
||||
"UI.getElementData",
|
||||
{name: "{{> UI.dynamic}}", id: "ui_dynamic"}
|
||||
],
|
||||
{type: "spacer"},
|
||||
{name: "Event maps", style: "noncode"}
|
||||
|
||||
Reference in New Issue
Block a user