Issues (62)

src/backbone_es6.js (3 issues)

Severity
1
//     Backbone.js 1.3.3
2
3
//     (c) 2010-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4
//     Backbone may be freely distributed under the MIT license.
5
//     For all details and documentation:
6
//     http://backbonejs.org
7
import $ from 'jquery';
0 ignored issues
show
Definition for rule 'keyword-spacing' was not found
Loading history...
8
import _ from 'underscore';
9
import {
10
  Backbone
11
} from './backbone_modules/core.js';
12
import {
13
  Events
14
} from './backbone_modules/events.js';
15
import {
16
  Model
17
} from './backbone_modules/model.js';
18
import {
19
  Collection
20
} from './backbone_modules/collection.js';
21
import {
22
  View
23
} from './backbone_modules/view.js';
24
import {
25
  Router
26
} from './backbone_modules/router.js';
27
import {
28
  History
29
} from './backbone_modules/history.js';
30
31
// Allow the `Backbone` object to serve as a global event bus, for folks who
32
// want global "pubsub" in a convenient place.
33
_.extend(Backbone, Events);
34
35
// Helpers
36
// -------
37
38
// Helper function to correctly set up the prototype chain for subclasses.
39
// Similar to `goog.inherits`, but uses a hash of prototype properties and
40
// class properties to be extended.
41
var extend = function (protoProps, staticProps) {
42
  var parent = this;
0 ignored issues
show
Unexpected alias 'parent' for 'this'.
Loading history...
43
  var child;
44
45
  // The constructor function for the new subclass is either defined by you
46
  // (the "constructor" property in your `extend` definition), or defaulted
47
  // by us to simply call the parent constructor.
48
  if (protoProps && _.has(protoProps, 'constructor')) {
49
    child = protoProps.constructor;
50
  } else {
51
    child = function () {
52
      return parent.apply(this, arguments);
53
    };
54
  }
55
56
  // Add static properties to the constructor function, if supplied.
57
  _.extend(child, parent, staticProps);
58
59
  // Set the prototype chain to inherit from `parent`, without calling
60
  // `parent`'s constructor function and add the prototype properties.
61
  child.prototype = _.create(parent.prototype, protoProps);
62
  child.prototype.constructor = child;
63
64
  // Set a convenience property in case the parent's prototype is needed
65
  // later.
66
  child.__super__ = parent.prototype;
67
68
  return child;
69
};
70
71
// Set up inheritance for the model, collection, router, view and history.
72
Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;
73
74
Backbone.Model = Model;
75
76
Backbone.Collection = Collection;
77
78
Backbone.View = View;
79
80
Backbone.Router = Router;
81
82
Backbone.History = History;
83
84
// Create the default Backbone.history.
85
Backbone.history = new History;
0 ignored issues
show
Missing '()' invoking a constructor
Loading history...
86
var history = Backbone.history;
87
88
var VERSION = Backbone.VERSION;
89
var noConflict = Backbone.noConflict;
90
var emulateHTTP = Backbone.emulateHTTP;
91
var emulateJSON = Backbone.emulateJSON;
92
var sync = Backbone.sync;
93
var ajax = Backbone.ajax;
94
var on = Backbone.on;
95
var listenTo = Backbone.listenTo;
96
var off = Backbone.off;
97
var stopListening = Backbone.stopListening;
98
var once = Backbone.once;
99
var listenToOnce = Backbone.listenToOnce;
100
var trigger = Backbone.trigger;
101
var bind = Backbone.bind;
102
var unbind = Backbone.unbind;
103
104
export {
105
  Backbone,
106
  VERSION,
107
  $,
108
  noConflict,
109
  emulateHTTP,
110
  emulateJSON,
111
  sync,
112
  ajax,
113
  Events,
114
  on,
115
  listenTo,
116
  off,
117
  stopListening,
118
  once,
119
  listenToOnce,
120
  trigger,
121
  bind,
122
  unbind,
123
  Model,
124
  Collection,
125
  View,
126
  Router,
127
  History,
128
  history
129
}
130
131
export default Backbone;
132