hawksley / eleVR-Web-Player

A Web Player for 360 Video on the Oculus
Mozilla Public License 2.0
681 stars 195 forks source link

Offer some type of distributable bundle #21

Open cvan opened 9 years ago

cvan commented 9 years ago

Though I'd be hesitant to introduce a Node + npm + Browserify stack to such a simple, straightforward project, it might be the best step forward to allow people to integrate the eleVR Web Player in their projects with minimal friction.

There could be

hawksley commented 9 years ago

Hmm. My first intuition is that this seems kind of overkill for what is really a pretty simple project. Although, it does seem like it is slowly gravitating towards getting bigger and more complicated over time.

hawksley commented 9 years ago

I guess it's also worth noting that I don't know how popular this project actually is, and what most users want. Is your intuition that this is something that most people would want?

hawksley commented 9 years ago

After some discussion, I'm good with going for this. Obviously, showing up on the issues page means that it's something that at least some people want and there are definite benefits to making the player easier for people to use. :)

cvan commented 9 years ago

Was just thinking about this, and I think a good first step (or compromise) would be to introduce a basic module import system like AMD. So the <script>s in the index.html would remain as is; the only changes required that come to mind:

  1. the addition of a loader file called like amd.js
  2. js/elevr-player.js would become the main "runtime" file that loads all the necessary dependencies
  3. wrap each JS file's contents in a define(…) function call (every file except lib/gl-matrix.js which can continue to be a global)

This would help reduce exposed globals, improve circular dependency issues.

Could use something like Require.js, but it seems like overkill for this project atm. Examples of a simple AMD solution I was thinking: