1

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() ?

Tushar
  • 85,780
  • 21
  • 159
  • 179
zwlayer
  • 1,752
  • 1
  • 18
  • 41
  • This is very basic, plain Javascript. You declare `Template.editor.rendered` as a function. Nothing more, nothing less. Nothing special about this particular *syntax*. – deceze Sep 09 '15 at 10:28
  • rendered is deprecated, use `onRendered(function(){` instead – sdooo Sep 09 '15 at 11:21

1 Answers1

1

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.

Tushar
  • 85,780
  • 21
  • 159
  • 179