backbone-toolbar
Advanced tools
Comparing version 0.0.4 to 0.0.5-0
@@ -289,5 +289,14 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
value: function get(id) { | ||
return _underscore2.default.chain(this._contexts).result(id).result('item').value(); | ||
return _underscore2.default.chain(this._contexts).result(id || this.rootId).result('item').value(); | ||
} | ||
}, { | ||
key: 'set', | ||
value: function set(id, options) { | ||
var item = _underscore2.default.isFunction(options) ? options(this.get(id)) : item; | ||
this.update(_underscore2.default.defaults({ | ||
id: id || this.rootId | ||
}, item)); | ||
} | ||
}, { | ||
key: 'update', | ||
@@ -297,7 +306,7 @@ value: function update(item) { | ||
var id = item.id || this._root.id; | ||
var id = item.id || this.rootId; | ||
var itemNew = _underscore2.default.defaults({ id: id }, item, this.get(id)); | ||
if (id === this._root.id) { | ||
if (!itemNew.type !== 'toolbar') { | ||
if (id === this.rootId) { | ||
if (itemNew.type !== 'toolbar') { | ||
throw new Error('The root item must be a toolbar'); | ||
@@ -331,6 +340,11 @@ } | ||
this.undelegateEvents(); | ||
this.$el.html(this._contexts[this._root.id].html); | ||
this.$el.html(this._contexts[this.rootId].html); | ||
this.delegateEvents(); | ||
return this; | ||
} | ||
}, { | ||
key: 'rootId', | ||
get: function get() { | ||
return this._root.id; | ||
} | ||
}]); | ||
@@ -337,0 +351,0 @@ |
{ | ||
"main": "dist/backbone-toolbar.js", | ||
"version": "0.0.4", | ||
"version": "0.0.5-0", | ||
"files": [ | ||
@@ -5,0 +5,0 @@ "dist" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
136647
1540