diff --git a/migrations.js b/migrations.js new file mode 100644 index 0000000..2988431 --- /dev/null +++ b/migrations.js @@ -0,0 +1,32 @@ +// bumps save versions + +migrations = [ + // 0 -> 1 + // notes: only adds version number + function(save) { + save["version"] = 1; + } + // +] + +function migrate(save, target=null) { + if (target == null) { + target = migrations.length; + } + + let version = save.version; + + if (version == undefined) { + version = 0; + } + + if (version < target) { + for (let x = version; x < target; x++) { + migrations[x](save); + } + } else { + return false; + } + + return true; +} diff --git a/stroll.html b/stroll.html index 8b66a26..9068b4b 100644 --- a/stroll.html +++ b/stroll.html @@ -6,6 +6,7 @@ Stroll + @@ -371,7 +372,7 @@

Lengths in meters, areas in square meters, masses in kilograms, times in seconds

(but you can preview the customary value)

Click on boxed titles to enable and disable features.

- +