X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Fmkws-team.js;h=1ea6a6378552eef6687ec1055ae4d54209105ccd;hb=b2d534358939d5b942863a9d5b4840221b6ad75d;hp=d6fc49f45cccfacc45411fa69daf7ca29685a58e;hpb=c7d64cb5450f7587ff8e7c10d043eea9a57f4026;p=mkws-moved-to-github.git diff --git a/src/mkws-team.js b/src/mkws-team.js index d6fc49f..1ea6a63 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -28,6 +28,7 @@ function team($, teamName) { var m_paz; // will be initialised below var m_template = {}; var m_config = mkws.objectInheritingFrom(mkws.config); + var m_widgets = {}; // Maps widget-type to object that.toString = function() { return '[Team ' + teamName + ']'; }; @@ -741,6 +742,22 @@ function team($, teamName) { return s; } + that.addWidget = function(w) { + if (!m_widgets[w.type]) { + m_widgets[w.type] = widget; + log("Registered '" + w.type + "' widget in team '" + m_teamName + "'"); + } else if (typeof(m_widgets[w.type]) !== 'number') { + m_widgets[w.type] = 2; + log("Registered duplicate '" + w.type + "' widget in team '" + m_teamName + "'"); + } else { + m_widgets[w.type] += 1; + log("Registered '" + w.type + "' widget #" + m_widgets[w.type] + "' in team '" + m_teamName + "'"); + } + } + + that.widget =function(type) { + return m_widgets[type]; + } mkwsHtmlAll()