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

mvcobject

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mvcobject - npm Package Compare versions

Comparing version 0.1.9 to 0.2.0

MVCObject.min.js

2

bower.json
{
"name": "mvcobject",
"main": "MVCObject.js",
"version": "0.1.6",
"version": "0.2.0",
"homepage": "https://github.com/Jeremial/MVCObject",

@@ -6,0 +6,0 @@ "authors": [

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

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.9.1
/**
* An implementation of Google Maps' MVCObject
*/
*/
(function() {
var Accessor, MVCObject,
__hasProp = {}.hasOwnProperty;
hasProp = {}.hasOwnProperty;

@@ -30,2 +30,3 @@ MVCObject = (function() {

/**

@@ -35,5 +36,4 @@ * @description 获取当前对象中给对应key对应的set方法

* @return {void}
*/
*/
getSetterName = function(key) {

@@ -47,2 +47,3 @@ if (setterNameCache.hasOwnProperty(key)) {

/**

@@ -52,5 +53,4 @@ * @description 是传入的字符串首字母大写

* @return {String} 首字符大写后的结果值
*/
*/
capitalize = function(str) {

@@ -60,2 +60,3 @@ return str.substr(0, 1).toUpperCase() + str.substr(1);

/**

@@ -65,5 +66,4 @@ * @description 获取uid

* @return {Number}
*/
*/
getUid = function(obj) {

@@ -73,2 +73,3 @@ return obj.__uid__ || (obj.__uid__ = ++uid);

/**

@@ -84,13 +85,12 @@ * @description 这个函数的触发需要时机

*
*/
*/
triggerChange = function(target, targetKey) {
var base, bindingObj, bindingUid, evt, ref, results;
evt = targetKey + "_changed";
triggerChange = function(target, targetKey) {
var bindingObj, bindingUid, evt, _base, _ref, _results;
evt = "" + targetKey + "_changed";
/**
* 优先检测并执行目标对象key对应的响应方法
* 其次检测并执行默认方法
*/
*/
if (target[evt]) {

@@ -104,13 +104,14 @@ target[evt]();

target.__bindings__ || (target.__bindings__ = {});
(_base = target.__bindings__)[targetKey] || (_base[targetKey] = {});
_ref = target.__bindings__[targetKey];
_results = [];
for (bindingUid in _ref) {
if (!__hasProp.call(_ref, bindingUid)) continue;
bindingObj = _ref[bindingUid];
_results.push(triggerChange(bindingObj.target, bindingObj.targetKey));
(base = target.__bindings__)[targetKey] || (base[targetKey] = {});
ref = target.__bindings__[targetKey];
results = [];
for (bindingUid in ref) {
if (!hasProp.call(ref, bindingUid)) continue;
bindingObj = ref[bindingUid];
results.push(triggerChange(bindingObj.target, bindingObj.targetKey));
}
return _results;
return results;
};
/**

@@ -120,5 +121,4 @@ * @description 从依赖链中获取对应key的值

* @return {String} 对应的值
*/
*/
MVCObject.prototype.get = function(key) {

@@ -146,2 +146,3 @@ var accessor, getterName, target, targetKey, value;

/**

@@ -153,5 +154,4 @@ * @description set方法遍历依赖链直到找到key的持有对象设置key的值;

* @return {void}
*/
*/
MVCObject.prototype.set = function(key, value) {

@@ -179,9 +179,10 @@ var accessor, setterName, target, targetKey;

/**
* @description 没个MVCObject对象各自的响应对应的key值变化时的逻辑
*/
*/
MVCObject.prototype.changed = function() {};
/**

@@ -191,5 +192,4 @@ * @description 手动触发对应key的事件传播

* @return {void}
*/
*/
MVCObject.prototype.notify = function(key) {

@@ -209,17 +209,18 @@ var accessor, target, targetKey;

MVCObject.prototype.setValues = function(values) {
var key, setterName, value, _results;
_results = [];
var key, results, setterName, value;
results = [];
for (key in values) {
if (!__hasProp.call(values, key)) continue;
if (!hasProp.call(values, key)) continue;
value = values[key];
setterName = getSetterName(key);
if (this[setterName]) {
_results.push(this[setterName](value));
results.push(this[setterName](value));
} else {
_results.push(this.set(key, value));
results.push(this.set(key, value));
}
}
return _results;
return results;
};
/**

@@ -231,7 +232,6 @@ * @description 将当前对象的一个key与目标对象的targetKey建立监听和广播关系

* @param noNotify {Boolean}
*/
*/
MVCObject.prototype.bindTo = function(key, target, targetKey, noNotify) {
var accessor, binding, _base;
var accessor, base, binding;
targetKey || (targetKey = key);

@@ -241,3 +241,3 @@ this.unbind(key);

target.__bindings__ || (target.__bindings__ = {});
(_base = target.__bindings__)[targetKey] || (_base[targetKey] = {});
(base = target.__bindings__)[targetKey] || (base[targetKey] = {});
binding = new Accessor(this, key);

@@ -253,2 +253,3 @@ accessor = new Accessor(target, targetKey);

/**

@@ -258,5 +259,4 @@ * @description 解除当前对象上key与目标对象的监听

* @return {void}
*/
*/
MVCObject.prototype.unbind = function(key) {

@@ -276,11 +276,11 @@ var accessor, target, targetKey;

MVCObject.prototype.unbindAll = function() {
var key, _ref, _results;
var key, ref, results;
this.__accessors__ || (this.__accessors__ = {});
_ref = this.__accessors__;
_results = [];
for (key in _ref) {
if (!__hasProp.call(_ref, key)) continue;
_results.push(this.unbind(key));
ref = this.__accessors__;
results = [];
for (key in ref) {
if (!hasProp.call(ref, key)) continue;
results.push(this.unbind(key));
}
return _results;
return results;
};

@@ -293,5 +293,5 @@

Accessor = (function() {
function Accessor(target, targetKey) {
this.target = target;
this.targetKey = targetKey;
function Accessor(target1, targetKey1) {
this.target = target1;
this.targetKey = targetKey1;
}

@@ -298,0 +298,0 @@

{
"name": "mvcobject",
"version": "0.1.9",
"version": "0.2.0",
"description": "An implementation of Google Maps' MVCObject for Node.js and browers",

@@ -21,4 +21,4 @@ "main": "MVCObject.js",

"contributors": [
"Treri <treri.liu@gmail.com>",
"saidz <zyx.zhuyuxiang@gmail.com>"
"Treri <treri.liu@gmail.com>",
"saidz <zyx.zhuyuxiang@gmail.com>"
],

@@ -30,8 +30,9 @@ "license": "MIT",

"devDependencies": {
"mocha": "~1.15.1",
"chai": "~1.8.1",
"coffee-script": "~1.7.1",
"sinon": "~1.7.3",
"sinon-chai": "~2.4.0"
"chai": "~2.1.2",
"coffee-script": "~1.9.1",
"mocha": "~2.2.1",
"sinon": "~1.14.1",
"sinon-chai": "~2.7.0",
"uglify-js": "^2.4.17"
}
}

Sorry, the diff of this file is not supported yet

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