Document UI.remove

Also tweak the warning about non-jQuery removals
This commit is contained in:
David Greenspan
2014-07-08 13:13:05 -07:00
parent 8afc41f0ef
commit fe1cd72a8e
3 changed files with 23 additions and 5 deletions

View File

@@ -2219,21 +2219,25 @@ changes.
Future releases will provide a richer API for working with rendered
templates, for example unifying them "template instances." For now, all you
can do with them is pass them to `UI.insert`.
{{/warning}}
{{#warning}}
Most users will not need to manually render templates or manually insert them
into the DOM at all. As of 0.8.0, if you call `UI.render` and never insert
into the DOM at all. As of 0.8.x, if you call `UI.render` and never insert
the result into the DOM, the logic to keep the rendered template updated
will continue running in your browser forever. Additionally, if you remove any
part of your DOM using any mechanism other than jQuery, the logic to keep that
part of the the DOM updated will continue running. To avoid these issues,
either avoid directly updating the DOM or ensure that any removals go through
jQuery.
part of your DOM using any mechanism other than Meteor or jQuery, the logic
to keep that part of the the DOM updated will continue running. To avoid these
issues, either avoid directly updating the DOM or ensure that any removals go
through Meteor or jQuery.
{{/warning}}
{{> api_box ui_renderwithdata}}
{{> api_box ui_insert}}
{{> api_box ui_remove}}
{{> api_box ui_getelementdata}}

View File

@@ -1917,6 +1917,19 @@ Template.api.ui_insert = {
}]
};
Template.api.ui_remove = {
id: "ui_remove",
name: "UI.remove(renderedTemplate)",
locus: "Client",
descr: ["Removes a rendered template from the DOM and destroys it, calling the [`destroyed`](#template_destroyed) callback and stopping the logic that reactively updates the template."],
args: [
{name: "renderedTemplate",
type: "Rendered template object",
descr: "The return value from `UI.render` or `UI.renderWithData`."
}
]
};
Template.api.ui_getelementdata = {
id: "ui_getelementdata",
name: "UI.getElementData(el)",

View File

@@ -261,6 +261,7 @@ var toc = [
"UI.render",
"UI.renderWithData",
"UI.insert",
"UI.remove",
"UI.getElementData"
],
{type: "spacer"},