Page 1 of 1

removeAll() has no to parameter?

Posted: 25 December 2014, 21:18
by sparr
removeFromStock( type, to )
Remove an item of the specific type from the stock.
"to" is an optional parameter. If "to" contains the ID of an HTML element, the item removed from the stock is slided to this HTML element before it disappear.
removeFromStockById( id, to )
Remove an item with a specific ID from the stock.
"to" is an optional parameter. If "to" contains the ID of an HTML element, the item removed from the stock is slided to this HTML element before it disappear.
removeAll()
Remove all items from the stock.
It would be helpful if removeAll() had an optional 'to' parameter like the other two functions, so we can skip writing things like this:

Code: Select all

        removeFromStock: function( stock, to )
        {
            cards = stock.getAllItems();
            for ( var i in cards )
            {
                stock.removeFromStockById( cards[i].id, to );
            }
        },