Created
July 13, 2009 12:54
-
-
Save phiggins42/146095 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dojo.declare("my.Thinger", null, { | |
oneDefault:"string", | |
anotherDefault:42, // number | |
constructor: function(href, additionalOptions){ | |
// if additionalOptions is null, nothing happens: | |
dojo.mixin(this, additionalOptions); | |
} | |
}); | |
// all defaults: | |
new my.Thinger("foo.com"); | |
// override default: | |
new my.Thinger("foo.com", { anotherDefault:27 }); | |
// special notes about shared arrays and objects | |
dojo.declare("my.OtherThinger", null, { | |
// these two become shared by all instances of this class, | |
// because of JS's object referencing | |
sharedArray:[1,2,3], | |
sharedObject:{ a:"b" }, | |
constructor: functionåç(args){ | |
// this one is not shared by all instances of this class | |
// it is unique to this instance. | |
this.instanceObject = args.instanceObject || {}; | |
this.insanceArray = args.instanceArray || []; | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment