Skip to content

Simplify JS dependency inclusion #40

@begriffs

Description

@begriffs

Code inside of lib/ needs to be included in both Phantom and a its simulated browser page. Phantom supports require() but the simulated page does not. This leads to weird code like this

var MODULE_NAME = (function () {
  var my = {};

  my.foo = function () { ... };
  // etc...

  if (typeof exports !== 'undefined') {
    _.extend(exports, my);
  }
  return my;
}()); 

This way it uses exports if that exists, otherwise it declares a global variable for the module which a page can reference.

Simplify this!

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions