Creo en nosotros. Wikipedia.
ShareCode
Permalink: http://www.treeweb.es/u/974/ 01/02/2011

ShareCode

1 var Notify = function() {2  this.notices = ([]);3  this.name = 'pedrito';4 };5 6 Notify.prototype.noticeUpdate = function() {7  for (k in this.notices)8  this.notices[k](this);9 };10 11 Notify.prototype.noticeAdd = function (n) {12  this.notices.push(n);13 };14 15 Notify.prototype.noticeClear = function() {16  17 };18 19 Notify.prototype.noticeRemove = function(n) {20  // TODO: if n in this.notices then remove all ocurrences of n inside it21 };22 23 var n = new Notify();24 25 n.noticeAdd(function(o) {26  alert('Soy la notificación A de nombre '+o.name);27 });28 29 n.noticeAdd(function (o){30  alert('Soy la notificación E de nombre '+o.name);31 });32 33 n.noticeAdd(function(o){34  alert('Soy la notificación C de nombre '+o.name);35 });36 37 n.noticeUpdate();
Enlace
El enlace para compartir es: