[Freeipa-devel] [PATCH] 0074 jslint cleanup
Endi Sukma Dewata
edewata at redhat.com
Wed Nov 3 19:13:52 UTC 2010
On 11/3/2010 1:20 PM, Adam Young wrote:
> Note the comment about "Forward declared"
> jslint complains if there is no forward declaration. I've postponed
> moving ipa_cmd into the IPA namespace in this patch, as that will cause
> a ripple effect through the rest of the .js files.
I've seen several ways to define class methods:
1. Global function: this seems to be good for large method.
function class_name() {
var that = {};
that.method = class_name_method;
return that;
}
function class_name_method() { }
2. Anonymous function: this seems to be good for simple methods.
function class_name() {
var that = {};
that.method = function() { };
return that;
}
3. Local function: this seems to be needed for passing a method
to super class.
function class_name(spec) {
spec.method1 = method1;
var that = super_class_name(spec)
that.method2 = spec.method2 || method2;
function method1() { }
function method2() { }
return that;
}
Any comments/suggestions?
--
Endi S. Dewata
More information about the Freeipa-devel
mailing list