update minor editors to use new realtime-input api

This commit is contained in:
ansuz
2016-03-07 11:52:18 +01:00
parent 9b228eea6b
commit 1c54af69a1
6 changed files with 68 additions and 53 deletions

View File

@@ -83,23 +83,26 @@ define([
}, 450);
};
var rts = Realtime.start($textarea[0], // window
Config.websocketURL, // websocketUrl
Crypto.rand64(8), // userName
key.channel, // channel
key.cryptKey, // cryptkey
{
// when remote editors do things...
onRemote: function () {
lazyDraw($textarea.val());
},
// when your editor is ready
onReady: function (info) {
if (info.userList) { console.log("Userlist: [%s]", info.userList.join(',')); }
console.log("Realtime is ready!");
$textarea.trigger('keyup');
}
});
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());
},
// when your editor is ready
onReady: function (info) {
if (info.userList) { console.log("Userlist: [%s]", info.userList.join(',')); }
console.log("Realtime is ready!");
$textarea.trigger('keyup');
}
};
var rts = Realtime.start(config);
$textarea.on('change keyup keydown', function () {
if (redrawTimeout) { clearTimeout(redrawTimeout); }