From 72cf6e03cdcd59094705a4c2543ba308162c9e34 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Wed, 4 Dec 2013 17:02:31 +0100 Subject: [PATCH] Add ol.Object#getProperties --- src/ol/object.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ol/object.js b/src/ol/object.js index 5b122f601c..1a14e785af 100644 --- a/src/ol/object.js +++ b/src/ol/object.js @@ -287,6 +287,23 @@ ol.Object.prototype.getKeys = function() { }; +/** + * Get an object of all property names and values. + * @return {Object.} Object. + */ +ol.Object.prototype.getProperties = function() { + var properties = {}; + var key; + for (key in this.values_) { + properties[key] = this.values_[key]; + } + for (key in ol.Object.getAccessors(this)) { + properties[key] = this.get(key); + } + return properties; +}; + + /** * Notify all observers of a change on this property. This notifies both * objects that are bound to the object's property as well as the object