screenright-client 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/src/index.ts +6 -4
package/dist/index.js
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
@@ -7,7 +7,8 @@ import FormData from 'form-data'
|
|
7
7
|
type ScreenshotItemAttribute = {
|
8
8
|
key: string
|
9
9
|
title: string
|
10
|
-
|
10
|
+
url: string
|
11
|
+
children: ScreenshotItemAttribute[]
|
11
12
|
}
|
12
13
|
|
13
14
|
type Result = {
|
@@ -109,18 +110,19 @@ export const capture = async (
|
|
109
110
|
const attribute: ScreenshotItemAttribute = {
|
110
111
|
key,
|
111
112
|
title,
|
112
|
-
|
113
|
+
url: page.url(),
|
114
|
+
children: [],
|
113
115
|
}
|
114
116
|
|
115
117
|
if (parentKey) {
|
116
118
|
const searchParent = (attributes: ScreenshotItemAttribute[]) => {
|
117
119
|
for (let i = 0; i < attributes.length; i++) {
|
118
120
|
if (attributes[i].key === parentKey) {
|
119
|
-
attributes[i].
|
121
|
+
attributes[i].children.push(attribute)
|
120
122
|
break
|
121
123
|
}
|
122
124
|
|
123
|
-
searchParent(attributes[i].
|
125
|
+
searchParent(attributes[i].children)
|
124
126
|
}
|
125
127
|
}
|
126
128
|
|