Running
1.function A (z) {this.z=z} // Assign 'this' in constructor, making it class-like
2.function B () {}
3.B.c = function () {}; // Add a static method, making it class-like
4.function C () {}
5.C.prototype.z = function () {}; // Add to prototype, making it behave as a "class"
6.get_declared_classes()
Could return
1.[C, B, A]
function get_declared_classes() {
// !No description available for get_declared_classes. @php.js developers: Please update the function summary text file.
//
// version: 902.1018
// discuss at: http://phpjs.org/functions/get_declared_classes
// + original by: Brett Zamir
// + depends on: class_exists
// * example 1: function A (z) {this.z=z} // Assign 'this' in constructor, making it class-like
// * example 1: function B () {}
// * example 1: B.c = function () {}; // Add a static method, making it class-like
// * example 1: function C () {}
// * example 1: C.prototype.z = function () {}; // Add to prototype, making it behave as a "class"
// * example 1: get_declared_classes()
// * returns 1: [C, B, A]
var i = '', arr = [], already = {};
var j = '';
for (i in window) {
try {
if (typeof window[i] === 'function') {
if (!already[i] && class_exists(i)) {
already[i] = 1;
arr.push(i);
}
} else if (typeof window[i] === 'object') {
for (j in window[i]) {
if (typeof window[j] === 'function' && window[j] && !already[j] && class_exists(j)) {
already[j] = 1;
arr.push(j);
}
}
}
} catch (e) {
}
}
return arr;
}