Closed konsumer closed 6 years ago
Actually, nevermind, I did it all with keydown. Seemed more reliable.
$('#bigpicture').on('keyup', '.text', function(e){
var $e = $(e.target);
var text = $e.html();
var id = $e.attr('id');
if (id){
if(text == ''){
socket.emit('post:remove', id);
}else{
var post = {
uuid: id,
x: $e.data('x'),
y: $e.data('y'),
size: $e.data('size'),
text: text
};
socket.emit('post:update', post);
}
}else{
var post = {
x: $e.data('x'),
y: $e.data('y'),
size: $e.data('size'),
text: text
};
socket.emit('post:create', post, function(id){
$e.attr('id', id);
});
}
})
I have an initial websocket version up at http://bigwall.herokuapp.com/
Oh we were working on the same thing at the same time : http://github.com/josephernest/BigBigPicture Let's merge our effort :) (PM: Would you like to discuss online, if so join me on twitter @JosephErnest and we'll see how to discuss)
I am working on a websocket version, and I needed events. This adds some minimal events to track what is happening.You can use them like this: