update minor editors to use new realtime-input api

pull/1/head
ansuz 9 years ago
parent 9b228eea6b
commit 1c54af69a1

@ -28,7 +28,13 @@ define([
transformFunction
*/
var config = {};
var config = {
textarea: $textarea[0],
websocketURL: Config.websocketURL,
userName: Crypto.rand64(8),
channel: key.channel,
cryptKey: key.cryptKey,
};
var initializing = true;
$textarea.attr('disabled', true);
@ -51,12 +57,7 @@ define([
window.alert("Server Connection Lost");
};
var rt = Realtime.start($textarea[0], // window
Config.websocketURL, // websocketUrl
Crypto.rand64(8), // userName
key.channel, // channel
key.cryptKey,
config); // cryptKey
var rt = Realtime.start(config);
$run.click(function (e) {
e.preventDefault();

@ -28,10 +28,13 @@ define([
var key = Crypto.parseKey(window.location.hash.substring(1));
var rttext =
RTText.start( $textarea[0], // window
Config.websocketURL, // websocketUrl
Crypto.rand64(8), // userName
key.channel, // channel
key.cryptKey); // cryptKey
var config = {
textarea: $textarea[0],
websocketURL: Config.websocketURL,
userName: Crypto.rand64(8),
channel: key.channel,
key.cryptKey
};
var rttext = RTText.start(config);
});

@ -18,11 +18,15 @@ define([
var key = Crypto.parseKey(window.location.hash.substring(1));
var rts = $('textarea').toArray().map(function (e, i) {
var rt = Realtime.start(e, // window
Config.websocketURL, // websocketUrl
Crypto.rand64(8), // userName
key.channel, // channel
key.cryptKey); // cryptKey
var config = {
textarea: e,
websocketURL: Config.websocketURL,
userName: Crypto.rand64(8),
channel: key.channel,
cryptKey: key.cryptKey
};
var rt = Realtime.start(config);
return rt;
});
});

@ -83,12 +83,13 @@ define([
}, 450);
};
var rts = Realtime.start($textarea[0], // window
Config.websocketURL, // websocketUrl
Crypto.rand64(8), // userName
key.channel, // channel
key.cryptKey, // cryptkey
{
var config = {
textarea: $textarea[0],
websocketURL: Config.websocketURL,
userName: Crypto.rand64(8),
channel: key.channel,
cryptKey: key.cryptKey,
// when remote editors do things...
onRemote: function () {
lazyDraw($textarea.val());
@ -99,7 +100,9 @@ define([
console.log("Realtime is ready!");
$textarea.trigger('keyup');
}
});
};
var rts = Realtime.start(config);
$textarea.on('change keyup keydown', function () {
if (redrawTimeout) { clearTimeout(redrawTimeout); }

@ -47,16 +47,20 @@ define([
.on('change', draw);
var rts = $('textarea').toArray().map(function (e, i) {
var rt = Realtime.start(e, // window
Config.websocketURL, // websocketUrl
userName, // userName
key.channel, // channel
key.cryptKey, // cryptKey
{
var config = {
onRemote: draw,
onInit: draw,
onReady: draw
});
onReady: draw,
textarea: e,
websocketURL: Config.websocketURL,
userName: userName,
channel: key.channel,
cryptKey: key.cryptKey
};
var rt = Realtime.start(config);
return rt;
});
});

@ -19,7 +19,12 @@ define([
var initializing = true;
var $textarea = $('textarea');
var config = {};
var config = {
websocketURL: Config.websocketURL,
userName: Crypto.rand64(8),
channel: key.channel,
cryptKey: key.cryptKey
};
var onInit = config.onInit = function (info) { };
@ -38,10 +43,5 @@ define([
window.alert("Server Connection Lost");
};
var rt = Realtime.start($textarea[0], // window
Config.websocketURL, // websocketUrl
Crypto.rand64(8), // userName
key.channel, // channel
key.cryptKey,
config); // cryptKey
var rt = Realtime.start(config);
});

Loading…
Cancel
Save