meaning of @scope in sproutcore

414 Views Asked by At

I'm using sproutcore, and I use sc-gen to generate a controller like this (this is from the sproutcore Todos tutorial):

sc-gen controller Todos.tasksController SC.ArrayController

In the generated javascript file, I find this javascript comment line:

/** @scope Todos.tasksController.prototype */

I wonder what this @scope does. Is this necessary? What tool is parsing this @scope keyword? Is this something specific to sproutcore or is this used in javascript in general?

1

There are 1 best solutions below

0
On BEST ANSWER

SproutCore supports the JSDoc standard for generated documentation.

The @scope syntax is part of this. There is a more in-depth explanation here:

http://code.google.com/p/jsdoc-toolkit/wiki/DocExamples#Changing_Scope

It is not necessary for your own code, if you don't intend on using JSDoc. But if you do, or you are using an editor/IDE that supports JSDoc (e.g. JetBrains WebStorm), then it's a good idea to keep it in.

When building your SC app, all comments are removed (in minification), so it won't hurt the size of your app.