I use the webkitAudioContext
constructor, which is native to webkit browsers, in my application written using Google Closure javascript.
After I compiled my javascript using Plovr in ADVANCED mode, I found that the decodeAudioData
method of my webkitAudioContext
object was renamed to the obfuscated term c
. To be concete,
Before compilation:
var myAudioContext = new webkitAudioContext();
myAudioContext.decodeAudioData(fileData, myCallBackFunction);
After compilation:
(new webkitAudioContext).c(a,b);
How do I tell the Closure javascript compiler to not obfuscate the names of methods of webkitAudioContext? I have tried to call
goog.exportSymbol('webkitAudioContext.prototype.decodeAudioData', webkitAudioContext.prototype.decodeAudioData);
to no avail.
As Felix Kling mentioned in his comment, externs files are used to prevent renaming externally defined symbols. The Closure Compiler source code has externs files under the following directories:
The externs file contrib/externs/w3c_audio.js includes webkitAudioContext
.
See the plovr externs config option.