在Classy javascript框架中进行$ super探测

时间:2012-06-04 03:41:02

标签: javascript

我无法理解Classy框架中的以下几行:

/* we check if $super is in use by a class if we can.  But first we have to
 check if the JavaScript interpreter supports that.  This also matches
 to false positives later, but that does not do any harm besides slightly
 slowing calls down. */
  var probe_super = (function(){$super();}).toString().indexOf('$super') > 0;
  function usesSuper(obj) {
    return !probe_super || /\B\$super\b/.test(obj.toString());
  }

何时以及如何使probe_super返回false?

1 个答案:

答案 0 :(得分:0)

正如评论所说,检查JavaScript解释器是否支持,所以你无法对它做任何事情,这取决于JavaScript解释器。