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

reading property of undefined #39

Open
Thomas-P opened this issue May 12, 2015 · 0 comments
Open

reading property of undefined #39

Thomas-P opened this issue May 12, 2015 · 0 comments

Comments

@Thomas-P
Copy link

If i use query-engine as a common module and convert them with browserify, then i got an error in line 5 of query-engine.js. This is the extend function of coffeescript, but it themes that the Backbone variable is the problem.

If i change

(function() {
  var Backbone, Criteria, Hash, Pill, Query, QueryCollection, queryEngine, util, _ref,
    __hasProp = {}.hasOwnProperty,
    __slice = [].slice,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
    __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
    __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

  Backbone = this.Backbone || (typeof window !== "undefined" && window !== null ? window.Backbone : void 0) || ((function() {
    try {
      return typeof require === "function" ? require('backbone') : void 0;
    } catch (_error) {}
  })()) || ((function() {
    try {
      return typeof require === "function" ? require('exoskeleton') : void 0;
    } catch (_error) {}
  })()) || null;

  util = { [...]

to

(function() {
  var Backbone, Criteria, Hash, Pill, Query, QueryCollection, queryEngine, util, _ref,
    __hasProp = {}.hasOwnProperty,
    __slice = [].slice,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
    __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
    __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

  Backbone = null;

  util = { [...]

it works fine. So i tested what i got back at the Backbone declaration. It themes that i will got an object instead of null. So the following parts act as i loaded Backbone an will extend functionallity from an undefined object. I hope it is not so confusing.

Thomas

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

No branches or pull requests

2 participants