diff --git a/boot/boot.js b/boot/boot.js index acdfa0327..68eb80799 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -84,6 +84,15 @@ $tw.utils.each = function(object,callback) { } }; +/* +Pushes a value to an array only when not yet contained. +*/ +$tw.utils.pushOnce = function(array,value) { + if(0 > array.indexOf(value)){ + array.push(value); + } +} + /* Helper for making DOM elements tag: tag name