From 7e092c7eac53f2d87498ff7189c538a0e68aaeda Mon Sep 17 00:00:00 2001 From: pandrr Date: Tue, 31 Oct 2023 15:16:58 +0100 Subject: [PATCH] new op comparraypushobject --- .../Ops.Data.Compose.CompArrayPushObject.js | 22 ++++++ .../Ops.Data.Compose.CompArrayPushObject.json | 77 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 src/ops/base/Ops.Data.Compose.CompArrayPushObject/Ops.Data.Compose.CompArrayPushObject.js create mode 100644 src/ops/base/Ops.Data.Compose.CompArrayPushObject/Ops.Data.Compose.CompArrayPushObject.json diff --git a/src/ops/base/Ops.Data.Compose.CompArrayPushObject/Ops.Data.Compose.CompArrayPushObject.js b/src/ops/base/Ops.Data.Compose.CompArrayPushObject/Ops.Data.Compose.CompArrayPushObject.js new file mode 100644 index 0000000000..600c114ee3 --- /dev/null +++ b/src/ops/base/Ops.Data.Compose.CompArrayPushObject/Ops.Data.Compose.CompArrayPushObject.js @@ -0,0 +1,22 @@ +const + update = op.inTrigger("Update"), + inObj = op.inObject("Object"), + next = op.outTrigger("Next"); + +update.onTriggered = () => +{ + if (op.patch.frameStore.compArray && op.patch.frameStore.compArray.length > 0) + { + let arr = op.patch.frameStore.compArray[op.patch.frameStore.compArray.length - 1]; + + try + { + arr.push(JSON.parse(JSON.stringify(inObj.get()))); + } + catch (e) + { + op.log("error comparraupusharray"); + } + } + next.trigger(); +}; diff --git a/src/ops/base/Ops.Data.Compose.CompArrayPushObject/Ops.Data.Compose.CompArrayPushObject.json b/src/ops/base/Ops.Data.Compose.CompArrayPushObject/Ops.Data.Compose.CompArrayPushObject.json new file mode 100644 index 0000000000..95d58d1a4f --- /dev/null +++ b/src/ops/base/Ops.Data.Compose.CompArrayPushObject/Ops.Data.Compose.CompArrayPushObject.json @@ -0,0 +1,77 @@ +{ + "id": "761d75d3-aaae-49ba-8df1-20d8012fb70a", + "changelog": [ + { + "message": "created op", + "author": "pandur", + "date": 1680619062207 + }, + { + "message": "Ops.Patch.PqYKyct.CreateArrayPushArray renamed to Ops.Team.CreateOps.Dev.CreateArrayPushArray", + "type": "rename", + "author": "pandur", + "date": 1680619193888 + }, + { + "message": "Ops.Team.CreateOps.Dev.CreateArrayPushArray renamed to Ops.Team.CreateOps.Dev.Dev.CompArrayPushArray", + "type": "rename", + "author": "pandur", + "date": 1680626244837 + }, + { + "message": "Ops.Team.CreateOps.Dev.Dev.CompArrayPushArray renamed to Ops.Team.CompOps.Dev.CompArrayPushArray", + "type": "rename", + "author": "pandur", + "date": 1680626323479 + }, + { + "message": "Ops.Team.CompOps.Dev.CompArrayPushArray renamed to Ops.Team.CompOps.CompArrayPushArray", + "type": "rename", + "author": "pandur", + "date": 1686661231934 + }, + { + "message": "Ops.Team.CompOps.CompArrayPushArray renamed to Ops.Data.Compose.CompArrayPushArray", + "type": "rename", + "author": "pandur", + "date": 1687167241210 + }, + { + "message": "cloned op from Ops.Data.Compose.CompArrayPushArray", + "author": "pandur", + "date": 1698418579461 + }, + { + "message": "Ops.Patch.Prb8ENJ.CompArrayPushObject renamed to Ops.Data.Compose.CompArrayPushObject", + "type": "rename", + "author": "pandur", + "date": 1698418841485 + } + ], + "layout": { + "portsIn": [ + { + "type": 1, + "name": "Update" + }, + { + "type": 2, + "name": "Object" + } + ], + "portsOut": [ + { + "type": 1, + "name": "Next" + } + ] + }, + "authorName": "pandur", + "created": 1698418579461, + "summary": "push/append an array to an array", + "collections": null, + "relatedops": null, + "docs": { + "ports": [] + } +}