ItemGroup
Defined in: core/items/igroup.ts:144
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ItemGroup():
ItemGroup
Returns
Section titled “Returns”ItemGroup
Methods
Section titled “Methods”addItems()
Section titled “addItems()”addItems(
items):Promise<ItemGroup>
Defined in: core/items/igroup.ts:165
param: (items: string || string[] || Item || Item[])
return: Promise<Item[]>Adds items into the group. Accepts an item ID or Item object or an array of those. Rejects when any of the provided items cannot be added into the group, such as, but not limited to already added into the group or another group, in another scene, or non-existent
var myItems;Scene.getItems().then(function(items) { // assuming myItems[0] is the group Item // can be added as a single Item object myItems[0].addItems(myItems[2]); // or via the item's id myItems[0].addItems(myItems[3]._id); // or via an array of them myItems[0].addItems([myItems[4],myItems[5]]);});Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”Promise<ItemGroup>
Implementation of
Section titled “Implementation of”getItems()
Section titled “getItems()”getItems():
Promise<Item[]>
Defined in: core/items/igroup.ts:147
return: Promise<Item[]>
Get all the items present in the group
grpItem.getItems().then(function(items) { // do something to each item in items array});Returns
Section titled “Returns”Promise<Item[]>
Implementation of
Section titled “Implementation of”removeItems()
Section titled “removeItems()”removeItems(
items):Promise<ItemGroup>
Defined in: core/items/igroup.ts:192
param: (items: string || string[] || Item || Item[])
return: Promise<Item[]>Removes the items from the group. This doesn’t actually remove the item from the scene, but only detaches itself from the group. Accepts an item ID or Item object or an array of those. Rejects when any of the provided items cannot be removed from the group,
var myItems;Scene.getItems().then(function(items) { // assuming myItems[0] is the group Item // can remove a single Item object myItems[0].removeItems(myItems[2]); // or via the item's id myItems[0].removeItems(myItems[3]._id); // or via an array of them myItems[0].removeItems([myItems[4],myItems[5]]);});Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”Promise<ItemGroup>
Implementation of
Section titled “Implementation of”unGroup()
Section titled “unGroup()”unGroup():
Promise<IItemGroup>
Defined in: core/items/igroup.ts:219
return: Promise<Item[]>
Removes all the items within the group. This doesn’t actually remove the items from the scene, but only detaches itself from the group. This also persists the group item in the scene. You would need to specifically remove the GroupItem if needed.
Scene.getItems().then(function(items) { if (myItems[0] instanceof XJS.GroupItem) { return myItems[0].unGroup(); }}).then(function() { myItems[0].remove()});Returns
Section titled “Returns”Promise<IItemGroup>