I agree it would be good to move out of the global space. We can take a
couple of different paths to accomplish this.

Option one -- Use augmentation to maintain file-by-file independence. We
could presumably use a form like:
var openpgp = (function(context) { .. })(openpgp || {});
in each of our js files to build the openpgp object up ad-hoc.  I think the
major downside to this is that references that are now to our more static
calls (like in crypto/cfb folders: openpgp_crypto_generateSessionKey) will
all have to be update, i.e.: openpgp.openpgp_crypto_generateSessionKey

Option two -- Concatenate all the files and then wrap the entire thing.
This is similar to what jQuery does with intro and outro (
https://github.com/jquery/jquery/tree/master/src). We have to make sure the
files are built in the same order, but I think it is the path of least
resistance. We could avoid some of the updating associated with option one.
It could also be worthwhile here to switch to a build system closer to what
jQuery uses with node/grunt to accomplish some of these tasks.

I think Option two is what we are better positioned for and also a good
path forward.

Thoughts?
Sean

On Sun, Mar 17, 2013 at 6:46 PM, Nils Kenneweg
<[email protected]>wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Am 16.03.2013 16:36, schrieb Tankred Hase:
> > This has only partly to do with this porblem. But Is anyone else
> > concerned about the fact that all functions of the library are
> > appended to the global object?
>
> Yep. Not really good practice, is it? Should also make the usage with
> things like requirejs difficult as far as I can see it.
>
> Even though changing it might be a hard refactoring work, it might be
> worth it.
>
> Greets,
> Nils
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.17 (MingW32)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQEcBAEBAgAGBQJRRkeqAAoJECvXQ9f0b0HogqQH/imt3ThGSwsgJgWOB/o9ZxqI
> HMpVwwzDvXOSfbKTdCrz4eDQlMNUd3hm6vVz0AYzhcpMX7DYzYyDS9tdhfULml/h
> w40d6FC0bdZsZYER6ypJXELoHVBqF8SdnHHo6eMF0p2Y3Q8VCv53h98MRvo6zaou
> di7/ySNT68lzAln9EcLtHVfBG4dQ3Ak3CqgRWiEBmxsW1zLDukwhHSFNTR2KRtU4
> 569tXrqLTBKfcER6uCb1NSu17ohZ6pyYCZL+fjdGfOACNbcwkCbUs1qnMXwzANYM
> 0SThtuE14iaM7cgoGD93ZQVNwXWAnF5Z1cciR1v3lqmTLzdY5Xa/X9hb7kHn0zE=
> =rp9y
> -----END PGP SIGNATURE-----
> _______________________________________________
>
> http://openpgpjs.org
>
_______________________________________________

http://openpgpjs.org

Reply via email to