Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bem-promised-models

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bem-promised-models - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

84

blocks/promised-models/__model/promised-models__model.js

@@ -284,2 +284,33 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

/**
* bind events on attributes or model
* @param {EventEmitter} eventEmitter
* @param {string} method of EventEmitter
* @param {string} [attribute] space separated list
* @param {string} event space separated list
* @param {Function} cb
* @param {*} [ctx]
*/
callEventEmitter = function (eventEmitter, method, attribute, event, cb, ctx) {
if (typeof event !== 'string') {
ctx = cb;
cb = event;
event = attribute;
attribute = undefined;
}
ctx = ctx || this;
if (attribute) {
attribute.split(/\s+/).forEach(function (attribute) {
event.split(/\s+/).forEach(function (event) {
eventEmitter[method](event + ':' + attribute, cb, ctx);
});
});
} else {
event.split(/\s+/).forEach(function (event) {
eventEmitter[method](event, cb, ctx);
});
}
},
/**
* @class

@@ -573,3 +604,7 @@ * @prop {object} [data] initial data

trigger: function () {
var callEmitter = this.__self._eventEmitter;
this._eventEmitter.emit.apply(this._eventEmitter, arguments);
if (callEmitter) {
callEmitter.emit.apply(callEmitter, arguments);
}
},

@@ -745,21 +780,3 @@

_callEventEmitter: function (method, attribute, event, cb, ctx) {
var model = this;
if (typeof event !== 'string') {
ctx = cb;
cb = event;
event = attribute;
attribute = undefined;
}
ctx = ctx || this;
if (attribute) {
attribute.split(/\s+/).forEach(function (attribute) {
event.split(/\s+/).forEach(function (event) {
model._eventEmitter[method](event + ':' + attribute, cb, ctx);
});
});
} else {
event.split(/\s+/).forEach(function (event) {
model._eventEmitter[method](event, cb, ctx);
});
}
callEventEmitter(this._eventEmitter, method, attribute, event, cb, ctx);
},

@@ -808,2 +825,31 @@

/**
* bind events for models of class
* @param {string} [attribute] space separated list
* @param {string} event space separated list
* @param {Function} cb
* @param {*} [ctx]
* @return {Model}
*/
on: function (attribute, event, cb, ctx) {
this._eventEmitter = this._eventEmitter || new EventEmitter();
callEventEmitter(this._eventEmitter, 'on', attribute, event, cb, ctx);
return this;
},
/**
* unbind events from models of class
* @param {string} [attribute] space separated list
* @param {string} event space separated list
* @param {Function} cb
* @param {*} [ctx]
* @return {Model}
*/
un: function (attribute, event, cb, ctx) {
if (this._eventEmitter) {
callEventEmitter(this._eventEmitter, 'removeListener', attribute, event, cb, ctx);
}
return this;
},
/**
* @class

@@ -810,0 +856,0 @@ * @abstract

{
"description": "BEM wrapper for promised-models",
"name": "bem-promised-models",
"version": "0.0.22",
"version": "0.0.23",
"repository": "git@github.com:delfrrr/bem-promised-models.git",

@@ -31,3 +31,3 @@ "keywords": [

"dependencies": {
"promised-models": "0.0.20"
"promised-models": "0.0.21"
},

@@ -34,0 +34,0 @@ "devDependencies": {

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