-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdataStorage.js
114 lines (97 loc) · 2.69 KB
/
dataStorage.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
var _dataService;
var getValue;
var setValue;
var wellThoughts;
var keepThoughts;
var stopThoughts;
var allActionItems;
var addWellThought;
var addKeepThought;
var addStopThought;
VSS.getService(VSS.ServiceIds.ExtensionData).then((dataService) => {
_dataService = dataService;
// _dataService.setValue("testData", 12345, {scopeType: "Project Collection"}).then(function(value) {
// console.log("User preference value is " + value);
// var abc = _dataService.getValue("testData", {scopeType: "Project Collection"}).then(function(value) {
// console.log("Read preference value is " + value);
// });
// });
setValue = (key, value, callback) => {
_dataService.setValue(key, value, {scopeType: "User"}).then(function(value) {
callback(value);
});
}
getValue = (key, callback) => {
_dataService.getValue(key, {scopeType: "User"}).then(function(value) {
callback(value);
});
}
getValue("wellThoughts", (value) => {
if(!value){
setValue("wellThoughts", [], (setValue) => {
wellThoughts = setValue;
if(wellThoughts && keepThoughts && stopThoughts) {
renderThoughtCategories();
}
});
}else {
wellThoughts = value;
if(wellThoughts && keepThoughts && stopThoughts) {
renderThoughtCategories();
}
}
});
getValue("keepThoughts", (value) => {
if(!value){
setValue("keepThoughts", [], (setValue) => {
keepThoughts = setValue;
if(wellThoughts && keepThoughts && stopThoughts) {
renderThoughtCategories();
}
});
}else {
keepThoughts = value;
if(wellThoughts && keepThoughts && stopThoughts) {
renderThoughtCategories();
}
}
});
getValue("stopThoughts", (value) => {
if(!value){
setValue("stopThoughts", [], (setValue) => {
stopThoughts = setValue;
if(wellThoughts && keepThoughts && stopThoughts) {
renderThoughtCategories();
}
});
}else {
stopThoughts = value;
if(wellThoughts && keepThoughts && stopThoughts) {
renderThoughtCategories();
}
}
});
getValue("actionItems", (value) => {
if(!value){
setValue("actionItems", [], (setValue) => {
allActionItems = setValue;
});
}else {
allActionItems = value;
dataSource = allActionItems;
grid.setDataSource(dataSource);
}
});
var addWellThought = (thoughts) => {
setValue("wellThoughts", thoughts, $.noop)
};
var addKeepThought = (thoughts) => {
setValue("keepThoughts", thoughts, $.noop)
};
var addStopThought = (thoughts) => {
setValue("stopThoughts", thoughts, $.noop)
};
addActionItems = (actionItems) => {
setValue("actionItems", actionItems, $.noop)
};
});