clonefun.js (386B)
1 // Functions which have been marked as singletons should not be cloned. 2 3 BeatDetektor = function() 4 { 5 this.config = BeatDetektor.config; 6 7 assertEq(this.config.a, 0); 8 assertEq(this.config.b, 1); 9 } 10 11 BeatDetektor.config_default = { a:0, b:1 }; 12 BeatDetektor.config = BeatDetektor.config_default; 13 14 var bd = new BeatDetektor(); 15 16 assertEq(bd.config === BeatDetektor.config, true);