bem-promised-models
Advanced tools
@@ -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 |
+2
-2
| { | ||
| "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": { |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
59195
2.73%1776
2.42%+ Added
- Removed
Updated