From ba9d6187aff5590278dfaa2b5554207b2d1c4b59 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Thu, 22 Dec 2016 08:15:16 +0000 Subject: [PATCH] Rename the dat saver to Beaker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s actually specific to the API provided by the Beaker browser, and not a generic Dat saver --- core/modules/savers/{dat.js => beaker.js} | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) rename core/modules/savers/{dat.js => beaker.js} (65%) diff --git a/core/modules/savers/dat.js b/core/modules/savers/beaker.js similarity index 65% rename from core/modules/savers/dat.js rename to core/modules/savers/beaker.js index 6b1940855..d1fe718b6 100644 --- a/core/modules/savers/dat.js +++ b/core/modules/savers/beaker.js @@ -1,9 +1,9 @@ /*\ -title: $:/core/modules/savers/dat.js +title: $:/core/modules/savers/beaker.js type: application/javascript module-type: saver -Saves wiki using the Dat protocol (https://datproject.org/) +Saves files using the Beaker browser's (https://beakerbrowser.com) Dat protocol (https://datproject.org/) \*/ (function(){ @@ -13,18 +13,17 @@ Saves wiki using the Dat protocol (https://datproject.org/) "use strict"; /* -Select the appropriate saver module and set it up +Set up the saver */ -var DatSaver = function(wiki) { +var BeakerSaver = function(wiki) { this.wiki = wiki; }; -DatSaver.prototype.save = function(text,method,callback) { -console.log("Saving Dat") +BeakerSaver.prototype.save = function(text,method,callback) { dat.writeFile(document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + document.location.pathname,text,"utf8").then(function(value) { callback(null); },function(reason) { - callback("Dat Saver Error: " + reason); + callback("Beaker Saver Error: " + reason); }); return true; }; @@ -32,8 +31,8 @@ console.log("Saving Dat") /* Information about this saver */ -DatSaver.prototype.info = { - name: "dat", +BeakerSaver.prototype.info = { + name: "beaker", priority: 3000, capabilities: ["save", "autosave"] }; @@ -49,7 +48,7 @@ exports.canSave = function(wiki) { Create an instance of this saver */ exports.create = function(wiki) { - return new DatSaver(wiki); + return new BeakerSaver(wiki); }; })();