-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
58 lines (52 loc) · 1.38 KB
/
test.js
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const Dreadlock = require('./index');
const Dread = new Dreadlock();
const keySet1 = ['key1', 'key2', 'key3'];
Dread.lock(keySet1)
.then(() => {
console.log('Working with keySet1.');
// Use your keySet1 keys here
console.log('Done with keySet1.');
return Dread.release(keySet1);
})
.then(() => {
console.log('keySet1 released.');
});
const keySet2 = ['key1', 'key4', 'key5'];
Dread.lock(keySet2)
.then(() => {
console.log('Working with keySet2.');
// Use your keySet2 keys here
console.log('Done with keySet2.');
return Dread.release(keySet2);
})
.then(() => {
console.log('keySet2 released.');
});
Dread.lock(keySet1)
.then(() => {
console.log('Working with keySet1.');
// Use your keySet1 keys here
console.log('Done with keySet1.');
setTimeout(() => Dread.release(keySet1), 500);
});
const keySet3 = ['key1', 'key6', 'key7'];
Dread.lock(keySet3)
.then(() => {
console.log('Working with keySet3.');
// Use your keySet3 keys here
console.log('Done with keySet3.');
return Dread.release(keySet3);
})
.then(() => {
console.log('keySet3 released.');
});
Dread.lock(keySet1)
.then(() => {
console.log('Working with keySet1.');
// Use your keySet1 keys here
console.log('Done with keySet1.');
return Dread.release(keySet1);
})
.then(() => {
console.log('keySet1 released.');
});