File tree Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change 1
1
class ChromeHistory extends History {
2
2
3
- collection = new Collection ( 'history' , [
4
- ...History . AVAILABLE_METHODS , 'login' , 'misc'
5
- ] )
3
+ constructor ( ) {
4
+ super ( )
5
+
6
+ this . collection = new Collection ( 'history' , [
7
+ ...History . AVAILABLE_METHODS , 'login' , 'misc'
8
+ ] )
9
+ }
6
10
7
11
async save ( method , params , result ) {
8
12
const { status } = result
Original file line number Diff line number Diff line change @@ -36,10 +36,12 @@ class TimeoutError extends Error {}
36
36
37
37
class InstagramConnector {
38
38
39
- isStopped = false
40
- isConnected = false
39
+ constructor ( ) {
40
+ this . isStopped = false
41
+ this . isConnected = false
42
+ }
41
43
42
- init = async ( ) => {
44
+ async init ( ) {
43
45
try {
44
46
const ping = await this . request ( {
45
47
method : 'ping'
@@ -59,10 +61,12 @@ class InstagramConnector {
59
61
60
62
}
61
63
62
- start = ( ) => this . isStopped = false
63
- kill = ( ) => this . isStopped = true
64
+ start ( ) { this . isStopped = false }
65
+ kill ( ) { this . isStopped = true }
66
+
67
+ request ( data ) {
68
+ return new Promise ( ( resolve , reject ) => {
64
69
65
- request = ( data ) => new Promise ( ( resolve , reject ) => {
66
70
if ( this . isStopped ) return reject ( new Error ( `Request was killed` ) )
67
71
68
72
// { method, params } = method
@@ -91,7 +95,10 @@ class InstagramConnector {
91
95
92
96
console . log ( `send_message` , null , { req_id, ...data } )
93
97
chrome . runtime . sendMessage ( null , { req_id, ...data } )
94
- } )
98
+
99
+ } )
100
+
101
+ }
95
102
96
103
}
97
104
You can’t perform that action at this time.
0 commit comments