modele.js (847B)
1 Array.prototype.remove = function(i) { 2 if (typeof i != "number") 3 i = this.indexOf(i); 4 this.splice(i,1); 5 return i; 6 } 7 8 Array.prototype.insert = function(v, i) { 9 if (arguments.length == 1) 10 i = this.length; 11 this.splice(i,0,v); 12 return i; 13 } 14 15 singleton = (function() { 16 var s = { uid: 0 }; 17 return { 18 uid: function () { 19 return s.uid++; 20 } 21 }; 22 })(); 23 24 function faireCallbacks(liste) { 25 var a = $.makeArray(arguments); 26 a.shift(); 27 for (var i = 0; i < liste.length; i++) { 28 liste[i].apply(a[0], a); 29 } 30 } 31 32 /*function InstancePort(port, instanceBlocParente) { 33 $.extend(this, { 34 uid: singleton.uid(), 35 // Propriétés 36 port: port, 37 // Parents 38 instanceBloc: instanceBlocParente, 39 // Enfants 40 liens: [] 41 }); 42 }*/