From 9ca80cf4b3b5bf46896b10b25a2f5663baca1298 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 30 May 2014 17:18:26 -0700 Subject: [PATCH] Added script that lists the current JS API --- examples/currentAPI.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/currentAPI.js diff --git a/examples/currentAPI.js b/examples/currentAPI.js new file mode 100644 index 0000000000..f926b4a02c --- /dev/null +++ b/examples/currentAPI.js @@ -0,0 +1,31 @@ +// +// currentAPI.js +// examples +// +// Created by Clément Brisset on 5/30/14. +// Copyright 2014 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + + +function listKeys(string, object) { + if (typeof(object) != "object") { + print(typeof(object) + " " + string); + return; + } + + var keys = Object.keys(object); + for (var i = 0; i < keys.length; ++i) { + if (string == "listKeys") { + return; + } else if (string == "") { + listKeys(keys[i], object[keys[i]]); + } else { + listKeys(string + "." + keys[i], object[keys[i]]); + } + } +} + +listKeys("", this); \ No newline at end of file