我将开始使用Facebook JavaScript SDK,并且在阅读源代码时发现了一个有趣的事情。
以下是代码示例:
所以,我的问题是这个用来干什么?做这个有什么好处?
顺便说一下,整个源代码在这里,你可以看到有很多annotate()被使用。 http://connect.facebook.net/en_US/all/debug.js
以下是代码示例:
/**
* 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?
所以,我的问题是这个用来干什么?做这个有什么好处?
顺便说一下,整个源代码在这里,你可以看到有很多annotate()被使用。 http://connect.facebook.net/en_US/all/debug.js