mirror of
https://github.com/zombieFox/nightTab.git
synced 2024-12-03 21:47:43 +01:00
53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
var update = (function() {
|
|
|
|
var _update_100 = function(data) {
|
|
var time = new Date().getTime();
|
|
data.bookmarks.forEach(function(arrayItem, index) {
|
|
time = time + 1;
|
|
arrayItem.timeStamp = time;
|
|
});
|
|
data.version = 1.00;
|
|
return data;
|
|
};
|
|
|
|
var _update_200 = function(data) {
|
|
state.change({
|
|
path: "layout.theme",
|
|
value: data.theme
|
|
});
|
|
data = {
|
|
state: state.get(),
|
|
bookmarks: data.bookmarks
|
|
};
|
|
data.version = 2.00;
|
|
return data;
|
|
};
|
|
|
|
// var _update_300 = function(data) {
|
|
// data.version = 3.00;
|
|
// return data;
|
|
// };
|
|
|
|
function render(data) {
|
|
if (!("version" in data)) {
|
|
console.log("\trunning update", 1.00);
|
|
data = _update_100(data);
|
|
};
|
|
if (data.version < 2.00) {
|
|
console.log("\trunning update", 2.00);
|
|
data = _update_200(data);
|
|
};
|
|
// if (data.version < 3.00) {
|
|
// console.log("\t# running update", 3.00);
|
|
// data = _update_300(data);
|
|
// };
|
|
return data;
|
|
};
|
|
|
|
// exposed methods
|
|
return {
|
|
render: render
|
|
};
|
|
|
|
})();
|