Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throws reference error when using Browserify (assuming will also throw error with other bundlers?) #44

Closed
lomaxap opened this issue Mar 28, 2016 · 2 comments

Comments

@lomaxap
Copy link

lomaxap commented Mar 28, 2016

Looks like d4 variable isn't available inside subsequent closures after the first when compiling with Browserify. As a quick-fix, I declared d4 variable outside all closures. Thoughts?

var d4;

(function() {
  'use strict';

  var root = this;
  var breaker = {};

  // Create a safe reference to the d4 object.
  d4 = function(obj) {
    if (obj instanceof d4) {
      return obj;
    }
    if (!(this instanceof d4)) {
      return new d4(obj);
    }
    this.d4Wrapped = obj;
  };
...
@heavysixer
Copy link
Owner

Looks reasonable to me. I'd suggest making this change as a PR after you ensure all tests pass (and adding tests as you feel necessary). I'd be happy to merge it down then.

@heavysixer
Copy link
Owner

closing this due to the PR you submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants