Phi: let plugins register additional properties
This commit is contained in:
parent
f0588144d1
commit
fd23166f43
1 changed files with 16 additions and 2 deletions
|
@ -175,9 +175,23 @@ define(['knockout'], function(ko) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.makeObservablesForAllProperties = function(target) {
|
self.addAliases = function(arg) {
|
||||||
for( var p in self.aliases ) {
|
self.aliases = self.aliases || {};
|
||||||
|
|
||||||
|
for( var p in arg ) {
|
||||||
if( self.aliases.hasOwnProperty(p) ) {
|
if( self.aliases.hasOwnProperty(p) ) {
|
||||||
|
console.log(p + " is already a property alias. Skipping.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
self.aliases[p] = arg[p];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.makeObservablesForAllProperties = function(target, aliases ) {
|
||||||
|
aliases = aliases || self.aliases;
|
||||||
|
|
||||||
|
for( var p in aliases ) {
|
||||||
|
if( aliases.hasOwnProperty(p) ) {
|
||||||
target[p] = ko.observable().extend({
|
target[p] = ko.observable().extend({
|
||||||
fgprop : p
|
fgprop : p
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue