goog.exportSymbol output

39 views
Skip to first unread message

Joshua Dwire

unread,
May 16, 2013, 2:46:26 PM5/16/13
to closure-comp...@googlegroups.com
I'm developing a library that sometimes needs the classes exported to form an API and sometimes needs them minified.

To do this, I have multiple calls to goog.exportSymbol. This creates quite a few duplicates of my namespace name in the output file. For example, here is one line of the output file:

x("sometechie.media.MediaIsLiveStreamError",ye);x("sometechie.media.PlaybackStartedEvent",de);x("sometechie.media.PlaybackStoppedEvent",ee);x("sometechie.media.PlaybackPausedEvent",fe);x("sometechie.media.PlaybackResumedEvent",ge);x("sometechie.media.VolumeChangedEvent",he);x("sometechie.media.SourceChangedEvent",ie);x("sometechie.media.LoadProgressEvent",je);x("sometechie.media.PositionChangedEvent",ke);x("sometechie.media.ErrorOccurredEvent",le);

I am guessing that x is the minified name for goog.exportSymbol. It seems that the size of the output file could be reduced if sometechie.media could be defined only once and then the properties could just be added instead of having to refer to it multiple times, so that the output would be something like the following, where w is defined somewhere else in the code:

x("sometechie.media",w)w.MediaIsLiveStreamError=ye;w.PlaybackStartedEvent=de;w.PlaybackStoppedEvent=ee;w.PlaybackPausedEvent=fe;w.PlaybackResumedEvent=ge;w.VolumeChangedEvent=he;w.SourceChangedEvent=ie;w.LoadProgressEvent=je;w.PositionChangedEvent=ke;w.ErrorOccurredEvent=le;

I've tried to figure out how to do something like this, but is there any way to do this without causing incomplete namespace alias errors?

Ilia Mirkin

unread,
May 16, 2013, 2:56:26 PM5/16/13
to closure-comp...@googlegroups.com
gzip encoding is usually pretty good at dealing with this. Try doing
it manually and compare the relative gzipped sizes. It's most likely
that the original will be smaller.
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Closure Compiler Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to closure-compiler-d...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Joshua Dwire

unread,
May 16, 2013, 3:01:02 PM5/16/13
to closure-comp...@googlegroups.com
That's a good point, I tend to forget that gzip further compresses the file. I agree that the original would probably end up being smaller. Though I am distributing the API, so those who use it may not have gzip enabled on their servers.
--
Joshua Dwire
Chief Technologist
Some Techie, LLC

You received this message because you are subscribed to a topic in the Google Groups "Closure Compiler Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/closure-compiler-discuss/W_UT_YrycGM/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to closure-compiler-d...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages