-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass.js
More file actions
41 lines (32 loc) · 808 Bytes
/
class.js
File metadata and controls
41 lines (32 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class A {
constructor() {
console.log('create A class')
if ('NODE_ENV' in process.env && (process.env.NODE_ENV === 'test' || process.env.NODE_ENV === 'loadtest')) {
console.log(1)
}
let _cash = null
Object.defineProperty(this, 'cash', {
get: () => _cash,
set: (v) => _cash = v
})
}
set car(car) { this._car = car }
get car() { return this._car }
async _check() {
await new Promise((resolve,reject) => resolve())
this.test()
console.log(this.exit)
}
test() {
console.log('wpw123123123123')
}
}
const cls = new A()
cls.car = 'test-1'
console.log('check', cls.car)
const cls2 = new A()
console.log('check 2', cls2.car)
console.log('check 2 - 1', cls2.cash)
cls2.cash = 'test'
console.log('check 2 - 2', cls2.cash)
cls._check()