summaryrefslogtreecommitdiff
path: root/src/node/db/API.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/node/db/API.js')
-rw-r--r--src/node/db/API.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/node/db/API.js b/src/node/db/API.js
index 87b6d747..237bcb0a 100644
--- a/src/node/db/API.js
+++ b/src/node/db/API.js
@@ -308,6 +308,38 @@ exports.setText = function(padID, text, callback)
}
/**
+appendText(padID, text) appends text to a pad
+
+Example returns:
+
+{code: 0, message:"ok", data: null}
+{code: 1, message:"padID does not exist", data: null}
+{code: 1, message:"text too long", data: null}
+*/
+exports.appendText = function(padID, text, callback)
+{
+ //text is required
+ if(typeof text != "string")
+ {
+ callback(new customError("text is no string","apierror"));
+ return;
+ }
+
+ //get the pad
+ getPadSafe(padID, true, function(err, pad)
+ {
+ if(ERR(err, callback)) return;
+
+ pad.appendText(text);
+
+ //update the clients on the pad
+ padMessageHandler.updatePadClients(pad, callback);
+ });
+};
+
+
+
+/**
getHTML(padID, [rev]) returns the html of a pad
Example returns: