aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/comments/frontend/optionalmethod.js
blob: 86415a844e35754af430c76c7906d834fa30a810 (plain)
1
2
3
4
5
6
7
8
9
10
11
// Calls a method that may or may not exist (optionalmethod.js)
HashOverConstructor.prototype.optionalMethod = function (name, args, object)
{
	var method = object ? this[object][name] : this[name];
	var context = object ? this[object] : this;

	// Check if the method exists
	if (method && typeof (method) === 'function') {
		return method.apply (context, args);
	}
};