我有一个与commonjs兼容的库/对象,我有另一个库/对象将自己添加到第一个库/对象。
我是否需要为commonjs手动包装第二个库,或者是否可以通过第一个库访问它?
我使用的两个库是backbone.js和backfire.js。
backbonejs已经导出了它的对象,我可以很好地访问它们。
backfirejs添加到骨干对象:
Backfire.js:
Backbone.Firebase = function(ref) {
this._fbref = ref;
this._children = [];
if (typeof ref == "string") {
this._fbref = new Firebase(ref);
}
_.bindAll(this);
this._fbref.on("child_added", this._childAdded);
this._fbref.on("child_moved", this._childMoved);
this._fbref.on("child_changed", this._childChanged);
this._fbref.on("child_removed", this._childRemoved);
};
如何使用commonjs访问Firebase对象?