Skip to content

Commit 0ace0da

Browse files
committed
remove modern js syntax
1 parent e1bfa68 commit 0ace0da

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

chrome-ext/background/storage/chrome_history.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
class ChromeHistory extends History {
22

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+
}
610

711
async save (method, params, result) {
812
const { status } = result

chrome-ext/popup/instagram_connector.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ class TimeoutError extends Error {}
3636

3737
class InstagramConnector {
3838

39-
isStopped = false
40-
isConnected = false
39+
constructor() {
40+
this.isStopped = false
41+
this.isConnected = false
42+
}
4143

42-
init = async () => {
44+
async init () {
4345
try {
4446
const ping = await this.request({
4547
method: 'ping'
@@ -59,10 +61,12 @@ class InstagramConnector {
5961

6062
}
6163

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) => {
6469

65-
request = (data) => new Promise((resolve, reject) => {
6670
if (this.isStopped) return reject(new Error(`Request was killed`))
6771

6872
// { method, params } = method
@@ -91,7 +95,10 @@ class InstagramConnector {
9195

9296
console.log(`send_message`, null, { req_id, ...data })
9397
chrome.runtime.sendMessage(null, { req_id, ...data })
94-
})
98+
99+
})
100+
101+
}
95102

96103
}
97104

0 commit comments

Comments
 (0)