1
0
Fork 0

Phi: let plugins register additional properties

This commit is contained in:
Torsten Dreyer 2016-01-14 10:29:49 +01:00
parent f0588144d1
commit fd23166f43

View file

@ -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
}); });