what is the purpose of the function annotation method in the Facebook
JavaScript SDK?
I'm starting using facebook javscript SDK, and I found a interesting thing
when I read the source code.
The code example is as belowed:
/**
* Annotates a function with a meta object
*/
function annotate(fn, meta) {
meta.superClass = fn.__superConstructor__;
fn.__TCmeta = meta;
return fn;
}
// export to global
__w = annotate;
/**
* when using the annotate function
*/
function sprintf(format) {
// function body
}
__w(sprintf, {"signature":"function(string)"}); // <-- what is the
purpose of doing this?
So, my question is what is that used for? What is the benefit doing this?
No comments:
Post a Comment