replace
Replace all the elements of a DefineList.
list.replace(collection)
Replaces every item in the list with collection
.
var names = new DefineList(["alice","adam","eve"]);
names.replace(["Justin","Xena"]);
names //-> DefineList["Justin","Xena"]
Parameters
- collection
{Array|can-define/list/list}
:The collection of items that will be in
list
.
Use
replace
is essentially a shortcut for splice.
Events
replace
causes remove, add, and length events.