creating closure compiler extern

前端 未结 2 1236
遥遥无期
遥遥无期 2020-12-11 04:29

I\'m using a jQuery plug-in and Google Closure Compiler. The problem is that there\'s a bug in the plug-in when I add the URL of that plug-in into the compilation, the compi

相关标签:
2条回答
  • 2020-12-11 05:08

    So I've been struggling on and off with this question for a while and I've come up with a working solution for others who have a plug-in they want to use in their code with closure compiler: instead of doing an extern, just use strings, like this:

    var TheObject = $['plugin']({...});
    
    var SomeVar = TheObject['someName']['otherName'](SomeString, {
    
          'prop1': [...],
    
          'onError': function () {...}  
    });
    
    TheObject['SomeMethod']();
    

    That may not work for everybody but this worked for me and saved me a great deal of hassle in terms of writing an extern. I found the doc online to be very confusing: either written by techies who explain what things are, but now how to use them, or written in a professorial tone, with not many empirical examples. I hope this answer will help others.

    0 讨论(0)
  • 2020-12-11 05:13

    Here you go:

    • How to Write Closure-compiler Extern Files – Part 1 The Basics
    • jQuery Plugins and Closure-Compiler

    I haven't had time to finish out the series on creating externs. If this isn't enough for your project, I'll revisit the topic.

    0 讨论(0)
提交回复
热议问题