New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

backbone-base-view

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-base-view - npm Package Compare versions

Comparing version 2.0.0-beta.3 to 2.0.0-beta.4

2

bower.json
{
"name": "backboneBaseView",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.4",
"description": "Baseview is a extended backbone view with convenient methods for manipulating subviews and events.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/dbrekalo/backbone-base-view",

@@ -129,3 +129,3 @@ (function(root, factory) {

if (this.viewsWithModel) {
if (view.model && this.viewsWithModel) {
delete this.viewsWithModel[view.model.cid];

@@ -132,0 +132,0 @@ }

@@ -1,1 +0,1 @@

!function(a,b){"function"==typeof define&&define.amd?define(["jquery","backbone","underscore"],b):"object"==typeof module&&module.exports?module.exports=b(require("jquery"),require("backbone"),require("underscore")):a.BaseView=b(a.jQuery,a.Backbone,a._)}(this,function(a,b,c){var d=this,e=/{{(\S+)}}/g,f=function(a,b){return a.replace(e,function(a,c){var e=0===c.indexOf("this."),f=e?b:d,g=(e?c.slice(5):c).split(".");for(var h in g)if(f=f[g[h]],"undefined"==typeof f)throw new Error("Undefined variable in event string");return f})},g=b.View.extend({constructor:function(){b.View.apply(this,arguments),this.events&&this.setupEvents()},delegatedEvents:!0,setupEvents:function(b){var e=this.ens=this.ens||"."+this.cid,g=b||this.events,h=this,i={window:d,document:d.document};return c.each("function"==typeof g?g.call(this):g,function(b,c){c=f(c,h);var d=0===c.indexOf("one:"),g=(d?c.slice(4):c).split(" "),j=g[0]+e,k=g.slice(1).join(" "),l=h.$el;i[k]?(l=h["$"+k]=h["$"+k]||a(i[k]),k=void 0):h.delegatedEvents||((h.elementsWithBoundEvents=h.elementsWithBoundEvents||[]).push(l=l.find(k)),k=void 0),l[d?"one":"on"](j,k,function(){("function"==typeof b?b:h[b]).apply(h,arguments)})}),this},removeEvents:function(){var a=this.ens;return a&&(this.$el&&this.$el.off(a),this.$document&&this.$document.off(a),this.$window&&this.$window.off(a),this.elementsWithBoundEvents&&(c.each(this.elementsWithBoundEvents,function(b){b.off(a)}),this.elementsWithBoundEvents=null)),this},addView:function(a,b){return this.views=this.views||{},this.views[a.cid]=a,a.model&&(this.viewsWithModel=this.viewsWithModel||{},this.viewsWithModel[a.model.cid]=a),b&&(this.viewsGroups=this.viewsGroups||{},this.viewsGroups[b]=this.viewsGroups[b]||{},this.viewsGroups[b][a.cid]=a),this.listenTo(a,"afterRemove",function(){delete this.views[a.cid],this.viewsWithModel&&delete this.viewsWithModel[a.model.cid],b&&this.viewsGroups&&this.viewsGroups[b]&&delete this.viewsGroups[b][a.cid]}),a},removeViews:function(a){return a?this.viewsGroups&&this.viewsGroups[a]&&(c.invoke(this.viewsGroups[a],"remove"),delete this.viewsGroups[a]):(this.views&&c.invoke(this.views,"remove"),delete this.views,delete this.viewsWithModel,delete this.viewsGroups),this},getViewByModel:function(a){return this.viewsWithModel&&this.viewsWithModel[a.cid]},removeViewByModel:function(a){return this.viewsWithModel&&this.viewsWithModel[a.cid]&&this.viewsWithModel[a.cid].remove(),this},addDeferred:function(a){return this.deferreds=this.deferreds||[],c.indexOf(this.deferreds,a)<0&&this.deferreds.push(a),a},abortDeferreds:function(){return this.deferreds&&c.each(this.deferreds,function(a){"object"==typeof a&&a.state&&"pending"===a.state()&&(a.abort?a.abort():a.reject())}),delete this.deferreds,this},when:function(b,e,f){c.each(b=c.isArray(b)?b:[b],function(a){this.addDeferred(a)},this);var g=a.when.apply(d,b);return e&&g.done(c.bind(e,this)),f&&g.fail(c.bind(f,this)),g},remove:function(){return this.trigger("beforeRemove"),this.removeEvents().abortDeferreds().removeViews(),b.View.prototype.remove.call(this),this.trigger("afterRemove"),this},setElement:function(a){return this._setElement(a),this}});return g.prototype.undelegateEvents=g.prototype.removeEvents,g.prototype.delegateEvents=g.prototype.setupEvents,g});
!function(a,b){"function"==typeof define&&define.amd?define(["jquery","backbone","underscore"],b):"object"==typeof module&&module.exports?module.exports=b(require("jquery"),require("backbone"),require("underscore")):a.BaseView=b(a.jQuery,a.Backbone,a._)}(this,function(a,b,c){var d=this,e=/{{(\S+)}}/g,f=function(a,b){return a.replace(e,function(a,c){var e=0===c.indexOf("this."),f=e?b:d,g=(e?c.slice(5):c).split(".");for(var h in g)if(f=f[g[h]],"undefined"==typeof f)throw new Error("Undefined variable in event string");return f})},g=b.View.extend({constructor:function(){b.View.apply(this,arguments),this.events&&this.setupEvents()},delegatedEvents:!0,setupEvents:function(b){var e=this.ens=this.ens||"."+this.cid,g=b||this.events,h=this,i={window:d,document:d.document};return c.each("function"==typeof g?g.call(this):g,function(b,c){c=f(c,h);var d=0===c.indexOf("one:"),g=(d?c.slice(4):c).split(" "),j=g[0]+e,k=g.slice(1).join(" "),l=h.$el;i[k]?(l=h["$"+k]=h["$"+k]||a(i[k]),k=void 0):h.delegatedEvents||((h.elementsWithBoundEvents=h.elementsWithBoundEvents||[]).push(l=l.find(k)),k=void 0),l[d?"one":"on"](j,k,function(){("function"==typeof b?b:h[b]).apply(h,arguments)})}),this},removeEvents:function(){var a=this.ens;return a&&(this.$el&&this.$el.off(a),this.$document&&this.$document.off(a),this.$window&&this.$window.off(a),this.elementsWithBoundEvents&&(c.each(this.elementsWithBoundEvents,function(b){b.off(a)}),this.elementsWithBoundEvents=null)),this},addView:function(a,b){return this.views=this.views||{},this.views[a.cid]=a,a.model&&(this.viewsWithModel=this.viewsWithModel||{},this.viewsWithModel[a.model.cid]=a),b&&(this.viewsGroups=this.viewsGroups||{},this.viewsGroups[b]=this.viewsGroups[b]||{},this.viewsGroups[b][a.cid]=a),this.listenTo(a,"afterRemove",function(){delete this.views[a.cid],a.model&&this.viewsWithModel&&delete this.viewsWithModel[a.model.cid],b&&this.viewsGroups&&this.viewsGroups[b]&&delete this.viewsGroups[b][a.cid]}),a},removeViews:function(a){return a?this.viewsGroups&&this.viewsGroups[a]&&(c.invoke(this.viewsGroups[a],"remove"),delete this.viewsGroups[a]):(this.views&&c.invoke(this.views,"remove"),delete this.views,delete this.viewsWithModel,delete this.viewsGroups),this},getViewByModel:function(a){return this.viewsWithModel&&this.viewsWithModel[a.cid]},removeViewByModel:function(a){return this.viewsWithModel&&this.viewsWithModel[a.cid]&&this.viewsWithModel[a.cid].remove(),this},addDeferred:function(a){return this.deferreds=this.deferreds||[],c.indexOf(this.deferreds,a)<0&&this.deferreds.push(a),a},abortDeferreds:function(){return this.deferreds&&c.each(this.deferreds,function(a){"object"==typeof a&&a.state&&"pending"===a.state()&&(a.abort?a.abort():a.reject())}),delete this.deferreds,this},when:function(b,e,f){c.each(b=c.isArray(b)?b:[b],function(a){this.addDeferred(a)},this);var g=a.when.apply(d,b);return e&&g.done(c.bind(e,this)),f&&g.fail(c.bind(f,this)),g},remove:function(){return this.trigger("beforeRemove"),this.removeEvents().abortDeferreds().removeViews(),b.View.prototype.remove.call(this),this.trigger("afterRemove"),this},setElement:function(a){return this._setElement(a),this}});return g.prototype.undelegateEvents=g.prototype.removeEvents,g.prototype.delegateEvents=g.prototype.setupEvents,g});
{
"name": "backbone-base-view",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.4",
"description": "Baseview is a extended backbone view with convenient methods for manipulating subviews and events.",

@@ -5,0 +5,0 @@ "main": "src/baseView.js",

@@ -129,3 +129,3 @@ (function(root, factory) {

if (this.viewsWithModel) {
if (view.model && this.viewsWithModel) {
delete this.viewsWithModel[view.model.cid];

@@ -132,0 +132,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc