我如何将功能标记为“私有"?要通过Google Closure Compiler重命名? [英] How i can mark function as "private" to renaming it by Google Closure Compiler?

查看:94
本文介绍了我如何将功能标记为“私有"?要通过Google Closure Compiler重命名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有私有函数createSomething():

I have private function createSomething():

function Player(id) {

  /**
   *  Creates stuff
   *  @private
   */
  this.createSomething = function() {
    // do something good
  };
}

,在使用Google Closure Compiler编译源代码后,我想看到重命名的函数"createSomething()". 是的,我知道ADVANCED_OPTIMIZATIONS,但是它与jQuery和其他库不兼容.

and I want to see the renamed function "createSomething()" after compiling the source with Google Closure Compiler. Yes, I know about ADVANCED_OPTIMIZATIONS but it is incompatible with jQuery and other libraries.

推荐答案

仅在不使用 this

Just use without this

function Player(id) {

  /**
   *  Creates stuff
   *  @private
   */
  createSomething = function() {
    // do something good
  };
}

这篇关于我如何将功能标记为“私有"?要通过Google Closure Compiler重命名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆