Commit c4165e2a authored by Sven Franck's avatar Sven Franck

jslint pass announcement.js

parent 4bf94351
var announcement = function(spec, my) {
var that = {};
spec = spec || {};
my = my || {};
// Attributes //
var callback_a = [];
var name = spec.name || '';
var announcer = spec.announcer || {};
// Methods //
that.add = function(callback) {
callback_a.push(callback);
};
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global announcement: true */
var announcement = function (spec, my) {
var that = {},
callback_a = [],
announcer = spec.announcer || {};
that.remove = function(callback) {
var i, tmp_callback_a = [];
for (i = 0; i < callback_a.length; i+= 1) {
if (callback_a[i] !== callback) {
tmp_callback_a.push(callback_a[i]);
}
}
callback_a = tmp_callback_a;
};
spec = spec || {};
my = my || {};
that.register = function() {
announcer.register(that);
};
// Methods //
that.add = function (callback) {
callback_a.push(callback);
};
that.unregister = function() {
announcer.unregister(that);
};
that.remove = function (callback) {
var i, tmp_callback_a = [];
for (i = 0; i < callback_a.length; i += 1) {
if (callback_a[i] !== callback) {
tmp_callback_a.push(callback_a[i]);
}
}
callback_a = tmp_callback_a;
};
that.trigger = function(args) {
var i;
for(i = 0; i < callback_a.length; i++) {
callback_a[i].apply(null, args);
}
};
that.register = function () {
announcer.register(that);
};
return that;
that.unregister = function () {
announcer.unregister(that);
};
that.trigger = function (args) {
var i;
for (i = 0; i < callback_a.length; i += 1) {
callback_a[i].apply(null, args);
}
};
return that;
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment