screenshotone-api-sdk 1.0.18 → 1.0.19
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/README.md +3 -1
- package/dist/main.js +34 -0
- package/package.json +1 -1
- package/src/main.ts +44 -0
package/README.md
CHANGED
|
@@ -7,6 +7,8 @@ An official [Screenshot API](https://screenshotone.com/) client for JavaScript a
|
|
|
7
7
|
|
|
8
8
|
It takes minutes to start taking screenshots. Just [sign up](https://screenshotone.com/) to get access and secret keys, import the client, and you are ready to go.
|
|
9
9
|
|
|
10
|
+
The SDK client is synchronized with the latest [screenshot API options](https://screenshotone.com/docs/options/).
|
|
11
|
+
|
|
10
12
|
## Installation
|
|
11
13
|
|
|
12
14
|
```shell
|
|
@@ -43,4 +45,4 @@ fs.writeFileSync("example.png", buffer)
|
|
|
43
45
|
|
|
44
46
|
## License
|
|
45
47
|
|
|
46
|
-
`screenshotone/jssdk` is released under [the MIT license](LICENSE).
|
|
48
|
+
`screenshotone/jssdk` is released under [the MIT license](LICENSE).
|
package/dist/main.js
CHANGED
|
@@ -76,12 +76,46 @@ class TakeOptions {
|
|
|
76
76
|
static url(url) {
|
|
77
77
|
return new TakeOptions(url);
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Initializes take screenshot options with provided HTML.
|
|
81
|
+
*/
|
|
82
|
+
static html(url) {
|
|
83
|
+
return new TakeOptions(url);
|
|
84
|
+
}
|
|
79
85
|
put(key, ...values) {
|
|
80
86
|
for (const value of values) {
|
|
81
87
|
this.query.append(key, value);
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
;
|
|
91
|
+
/**
|
|
92
|
+
* Selector is a CSS-like selector of the element to take a screenshot of.
|
|
93
|
+
*/
|
|
94
|
+
selector(selector) {
|
|
95
|
+
this.put("selector", selector);
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* It determines the behavior of what to do when selector is not found.
|
|
100
|
+
*/
|
|
101
|
+
errorOnSelectorNotFound(errorOn) {
|
|
102
|
+
this.put("error_on_selector_not_found", errorOn ? "true" : "false");
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Styles specifies custom CSS styles for the page.
|
|
107
|
+
*/
|
|
108
|
+
styles(styles) {
|
|
109
|
+
this.put("styles", styles);
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Scripts specifies custom scripts for the page.
|
|
114
|
+
*/
|
|
115
|
+
scripts(scripts) {
|
|
116
|
+
this.put("scripts", scripts);
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
85
119
|
/**
|
|
86
120
|
* Renders the full page.
|
|
87
121
|
*/
|
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -63,12 +63,56 @@ export class TakeOptions {
|
|
|
63
63
|
return new TakeOptions(url);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Initializes take screenshot options with provided HTML.
|
|
68
|
+
*/
|
|
69
|
+
static html(url: string): TakeOptions {
|
|
70
|
+
return new TakeOptions(url);
|
|
71
|
+
}
|
|
72
|
+
|
|
66
73
|
private put(key: string, ...values: string[]) {
|
|
67
74
|
for (const value of values) {
|
|
68
75
|
this.query.append(key, value);
|
|
69
76
|
}
|
|
70
77
|
};
|
|
71
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Selector is a CSS-like selector of the element to take a screenshot of.
|
|
81
|
+
*/
|
|
82
|
+
selector(selector: string) {
|
|
83
|
+
this.put("selector", selector);
|
|
84
|
+
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* It determines the behavior of what to do when selector is not found.
|
|
90
|
+
*/
|
|
91
|
+
errorOnSelectorNotFound(errorOn: boolean) {
|
|
92
|
+
this.put("error_on_selector_not_found", errorOn ? "true" : "false");
|
|
93
|
+
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Styles specifies custom CSS styles for the page.
|
|
99
|
+
*/
|
|
100
|
+
styles(styles: string) {
|
|
101
|
+
this.put("styles", styles);
|
|
102
|
+
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Scripts specifies custom scripts for the page.
|
|
108
|
+
*/
|
|
109
|
+
scripts(scripts: string) {
|
|
110
|
+
this.put("scripts", scripts);
|
|
111
|
+
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
72
116
|
/**
|
|
73
117
|
* Renders the full page.
|
|
74
118
|
*/
|