zwlayer
zwlayer

Reputation: 1824

what is the Template.templateName.rendered= function(){} in Meteor js

This is my first Meteor project and I'm trying to understand the Meteor itself at the same time. Now I've came across with the following syntax :

Template.editor.rendered = function() {
    // some stuff here 
}

Altough I've looked at the web, I could not find what is this kind of function. I mean I wonder what should I put inside this function and when this function will be called ? For example, if I have a url like localhost:3000/test, when I type this url into browser, does this action call Template.test.rendered= function() ?

Upvotes: 1

Views: 152

Answers (1)

Tushar
Tushar

Reputation: 87203

The rendered callback is similar to ready() in jQuery or DOMContentLoaded in Vanilla Javascript.

From Docs

Register a function to be called when an instance of this template is inserted into the DOM.

Callbacks added with this method are called once when an instance of Template.myTemplate is rendered into DOM nodes and put into the document for the first time.

Upvotes: 1

Related Questions