0

I'm trying to take advantage of Google Closure Compiler minification by writing a database script of my own and compiling it with the pre-compiled ydn. To get a basic first version working I'm trying to rewrite the todo list demo from the project. Unfortunately, I don't understand how to keep namespaces for ydn functions preserved in the compiled output file.

Here's what I've written so far: http://pastebin.com/6YhnRuD5

When the code compiles in advanced mode, the "ydn.db.Storage" from "db = new ydn.db.Storage(dbName, Schema)" gets munged into "ydn.db.c$" making it unusable. The goog.exportSymbol at the bottom of the file doesn't seem to save the function names either.

Does anyone know how to rewrite this with Google Closure Compiler? Should this be compiled directly with the ydn source code instead?

pwg
  • 11
  • Can't you compile your code and ydn code together, when ydn code get's shortened your calling code get's shortened as well. While you test I suggest using uncompiled code. Here is some info about using a 3rd party library in your project: http://stackoverflow.com/questions/16432800/wiki-how-to-use-lime-how-to-use-closure-compiler-with-3rd-party-closure-libr – HMR Jun 03 '13 at 09:45

1 Answers1

0

The goog.exportSymbol at the bottom of the file doesn't seem to save the function names either.

It should.

goog.exportSymbol("ydn.db.Storage");

should be

goog.exportSymbol('ydn.db.Storage', ydn.db.Storage);
Kyaw Tun
  • 12,447
  • 10
  • 56
  • 83