It would be helpful if removeAll() had an optional 'to' parameter like the other two functions, so we can skip writing things like this: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.
Code: Select all
removeFromStock: function( stock, to )
{
cards = stock.getAllItems();
for ( var i in cards )
{
stock.removeFromStockById( cards[i].id, to );
}
},