mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
added createPad
This commit is contained in:
parent
8dabdc8e95
commit
9fa52c0e66
4 changed files with 102 additions and 32 deletions
|
@ -31,11 +31,18 @@ globalPads = [];
|
|||
* @param id A String with the id of the pad
|
||||
* @param {Function} callback
|
||||
*/
|
||||
exports.getPad = function(id, callback)
|
||||
exports.getPad = function(id, text, callback)
|
||||
{
|
||||
if(!exports.isValidPadId(id))
|
||||
throw new Error(id + " is not a valid padId");
|
||||
|
||||
//make text an optional parameter
|
||||
if(typeof text == "function")
|
||||
{
|
||||
callback = text;
|
||||
text = null;
|
||||
}
|
||||
|
||||
var pad = globalPads[id];
|
||||
|
||||
//return pad if its already loaded
|
||||
|
@ -49,7 +56,7 @@ exports.getPad = function(id, callback)
|
|||
pad = new Pad(id);
|
||||
|
||||
//initalize the pad
|
||||
pad.init(function(err)
|
||||
pad.init(text, function(err)
|
||||
{
|
||||
if(err)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue