File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @codebolt/codeboltjs" ,
3- "version" : " 1.1.37 " ,
3+ "version" : " 1.1.38 " ,
44 "description" : " " ,
55 "keywords" : [],
66 "author" : " " ,
Original file line number Diff line number Diff line change @@ -152,6 +152,44 @@ const cbbrowser = {
152152 } ) ;
153153 } ) ;
154154 } ,
155+ /**
156+ * Retrieves the snapshot of the current page.
157+ * @returns {Promise<GetContentResponse> } A promise that resolves with the content.
158+ */
159+ getSnapShot : ( ) :Promise < any > => {
160+
161+ return new Promise ( ( resolve , reject ) => {
162+ cbws . getWebsocket . send ( JSON . stringify ( {
163+ "type" : "browserEvent" ,
164+ action : 'getSnapShot'
165+ } ) ) ;
166+ cbws . getWebsocket . on ( 'message' , ( data : string ) => {
167+ const response = JSON . parse ( data ) ;
168+ if ( response . event === "getSnapShotResponse" ) {
169+ resolve ( response ) ;
170+ }
171+ } ) ;
172+ } ) ;
173+ } ,
174+ /**
175+ * Retrieves browser info like height width scrollx scrolly of the current page.
176+ * @returns {Promise<GetContentResponse> } A promise that resolves with the content.
177+ */
178+ getBrowserInfo : ( ) :Promise < any > => {
179+
180+ return new Promise ( ( resolve , reject ) => {
181+ cbws . getWebsocket . send ( JSON . stringify ( {
182+ "type" : "browserEvent" ,
183+ action : 'getBrowserInfo'
184+ } ) ) ;
185+ cbws . getWebsocket . on ( 'message' , ( data : string ) => {
186+ const response = JSON . parse ( data ) ;
187+ if ( response . event === "getBrowserInfoResponse" ) {
188+ resolve ( response ) ;
189+ }
190+ } ) ;
191+ } ) ;
192+ } ,
155193
156194 /**
157195 * Extracts text from the current page.
You can’t perform that action at this time.
0 commit comments