1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 23:03:15 +00:00

Rename the dat saver to Beaker

It’s actually specific to the API provided by the Beaker browser, and
not a generic Dat saver
This commit is contained in:
Jermolene 2016-12-22 08:15:16 +00:00
parent cec5522b72
commit ba9d6187af

View File

@ -1,9 +1,9 @@
/*\ /*\
title: $:/core/modules/savers/dat.js title: $:/core/modules/savers/beaker.js
type: application/javascript type: application/javascript
module-type: saver 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(){ (function(){
@ -13,18 +13,17 @@ Saves wiki using the Dat protocol (https://datproject.org/)
"use strict"; "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; this.wiki = wiki;
}; };
DatSaver.prototype.save = function(text,method,callback) { BeakerSaver.prototype.save = function(text,method,callback) {
console.log("Saving Dat")
dat.writeFile(document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + document.location.pathname,text,"utf8").then(function(value) { dat.writeFile(document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + document.location.pathname,text,"utf8").then(function(value) {
callback(null); callback(null);
},function(reason) { },function(reason) {
callback("Dat Saver Error: " + reason); callback("Beaker Saver Error: " + reason);
}); });
return true; return true;
}; };
@ -32,8 +31,8 @@ console.log("Saving Dat")
/* /*
Information about this saver Information about this saver
*/ */
DatSaver.prototype.info = { BeakerSaver.prototype.info = {
name: "dat", name: "beaker",
priority: 3000, priority: 3000,
capabilities: ["save", "autosave"] capabilities: ["save", "autosave"]
}; };
@ -49,7 +48,7 @@ exports.canSave = function(wiki) {
Create an instance of this saver Create an instance of this saver
*/ */
exports.create = function(wiki) { exports.create = function(wiki) {
return new DatSaver(wiki); return new BeakerSaver(wiki);
}; };
})(); })();