Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Combining YWA and YWAT objects
- function YWAT(pid) {
- /* constructor code */
- }
- YWAT.prototype = {
- /* prototype */
- };
- YWAT.PID = 12345;
- ...
- YWAT.getTracker = function (pid) {
- /* assorted boilerplate */
- return new YWAT(pid);
- };
- // Or namespacing
- YWA.Tracker = function (pid) {
- ...
- };
- YWA.getTracker(pid) {
- /* assorted boilerplate */
- return new YWA.Tracker(pid);
- }
- // Or if the class constructor needs to be private
- (function (win, doc, undef) {
- function Tracker(pid) {
- ...
- }
- YWA = {
- ...
- getTracker: function (pid) {
- /* assorted boilerplate */
- return new Tracker(pid);
- }
- };
- })(window, document);
Add Comment
Please, Sign In to add comment