I specifically refer to the anonymous JavaScript function, but this may be relevant to other languages. I like to use JSDoc notations in my scripts because I know that other people will hack it sooner or later. When I have a rather complicated anonymous function, how do people document it so that it is compiled by Eclipse and other IDEs that understand JSDoc or JavaDoc notations?
/** * Blah Blah blah * * @param Object Blah blah blah * @return Blah Blah Blah * @type Object */ function foo(this) { ...... this.bar = function () { ... complex code .....}; ...... return obj; }
thank
Ideally, an anonymous function should be short and perform a direct task. So ... the external function that contains it should provide sufficient documentation.
, , , , .
. . "bar", , , "foo.bar". , , , . , - , , :
var intervalId = setTimeout(function() { // statements }, 1000);
, Javascript: The Definitive Guide, - " Function()". , , "" .
? , -, . , "" Javascript , , -.
Not anonymously.
I believe the best way to document something is wrong. I mean, I use good variable / function names and clean code as my document.
So, in this case, I would just create a static function that creates this anonymous, and so I can give this static function a good name .it
Source: https://habr.com/ru/post/1740018/More articles:Namespace is repeated in all nodes using axis2 and java2wdsl - javaHow to save selection in DataGrid when data changes? - flexПанорамный вид в Windows Mobile (silverlight 4) - windows-phone-7MSMQ Inconsistent state after restart - asp.netJasper Report: how to configure JasperViewer so that it can export in only one format? - javaConfiguring ProcessStartInfo.WorkingDirectory on a UNC path - c #Import IIS Log in SQL Server 2008 - sql-serverError starting Eclipse when copying and pasting - eclipseVisual Studio Test startup detection - tddWhat is the maximum allowed URL size for a GET request in IE8? - internet-explorerAll Articles