generate-js-bindings
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -33,2 +33,16 @@ var EventEmitter = require('generate-js-events'); | ||
function makeGetter(bindable, property) { | ||
return function getter() { | ||
var _ = this; | ||
return bindable.get(property); | ||
}; | ||
} | ||
function makeSetter(bindable, property) { | ||
return function setter() { | ||
var _ = this; | ||
return bindable.set(property); | ||
}; | ||
} | ||
Bindable.generateGetters = function generateGetter(bindable, descriptor, properties) { | ||
@@ -42,13 +56,8 @@ var getters = {}, | ||
function makeGetter(property) { | ||
return function getter() { | ||
var _ = this; | ||
return bindable.get(property); | ||
for (var i = 0; i < properties.length; i++) { | ||
getters[properties[i]] = { | ||
get: makeGetter(bindable, properties[i]) | ||
}; | ||
} | ||
for (var i = 0; i < properties.length; i++) { | ||
getters[properties[i]] = { get: makeGetter(properties[i]) }; | ||
} | ||
bindable.definePrototype(descriptor, getters); | ||
@@ -65,14 +74,27 @@ }; | ||
function makeSetter(property) { | ||
return function setter() { | ||
var _ = this; | ||
return bindable.set(property); | ||
for (var i = 0; i < properties.length; i++) { | ||
setters[properties[i]] = { | ||
set: makeSetter(bindable, properties[i]) | ||
}; | ||
} | ||
bindable.definePrototype(descriptor, setters); | ||
}; | ||
Bindable.generateGettersSetters = function generateGetter(bindable, descriptor, properties) { | ||
var gettersSetters = {}, | ||
p = properties || descriptor, | ||
d = properties && descriptor; | ||
properties = (p && typeof p === 'object') ? p : {}; | ||
descriptor = (d && typeof d === 'object') ? d : { enumerable: true }; | ||
for (var i = 0; i < properties.length; i++) { | ||
setters[properties[i]] = { set: makeSetter(properties[i]) }; | ||
gettersSetters[properties[i]] = { | ||
get: makeGetter(bindable, properties[i]), | ||
set: makeSetter(bindable, properties[i]) | ||
}; | ||
} | ||
bindable.definePrototype(descriptor, setters); | ||
bindable.definePrototype(descriptor, gettersSetters); | ||
}; | ||
@@ -79,0 +101,0 @@ |
{ | ||
"name": "generate-js-bindings", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A data binding layer for Generate JS.", | ||
@@ -27,4 +27,4 @@ "main": "bindings.js", | ||
"dependencies": { | ||
"generate-js-events": "^2.1.2" | ||
"generate-js-events": "^2.1.3" | ||
} | ||
} |
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
12263
197
Updatedgenerate-js-events@^2.1.3