Firepad sync after onClick vs onKeyUp

25 views
Skip to first unread message

Maarten

unread,
May 4, 2016, 8:14:16 AM5/4/16
to Firepad
Is it possible for Firepad to only sync when a button (like save) is clicked, as opposed to syncing after every keystroke?

Michael Lehenbauer

unread,
May 4, 2016, 12:22:27 PM5/4/16
to Maarten, Firepad
Hrm...  That's not really what it's designed for.  Do you still want collaborative editing (to see other people's edits)?  Or are you just looking for a one-way "save to database" behavior?  If the latter, you might be better served just using the normal Firebase client to save the entire editor when "save" is clicked or something.

-Michael

On Wed, May 4, 2016 at 5:14 AM, Maarten <maarte...@gmail.com> wrote:
Is it possible for Firepad to only sync when a button (like save) is clicked, as opposed to syncing after every keystroke?

--
You received this message because you are subscribed to the Google Groups "Firepad" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firepad-io+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firepad-io/bbb22954-05e1-4a55-a5ee-828e06a47e19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Maarten

unread,
May 4, 2016, 1:42:52 PM5/4/16
to Firepad, maarte...@gmail.com
Oh yes I am looking for collaborative editing alright. Just not that superduper realtime.
I am building a text editor that can be used offline as well. So user X can create a document and take it offline to edit if further. In the meanwhile it may have been edited by user Y. When user X gets online again, both docs should be merged to represent latest revision.

Op woensdag 4 mei 2016 18:22:27 UTC+2 schreef Michael Lehenbauer:

Michael Lehenbauer

unread,
May 4, 2016, 3:01:10 PM5/4/16
to Maarten, Firepad
When do you want to see other users' edits?  When you press "save" (so it'll sync in both directions at that time)?  Or before that?

Maarten

unread,
May 4, 2016, 3:11:10 PM5/4/16
to Firepad, maarte...@gmail.com
I guess I want to see edits immediately once they're available. Typically that would be when a user presses save, yes.

Op woensdag 4 mei 2016 21:01:10 UTC+2 schreef Michael Lehenbauer:

Michael Lehenbauer

unread,
May 4, 2016, 4:27:58 PM5/4/16
to Maarten, Firepad
So you want to *receive* updates continuously (whenever another user presses "save") but only *send* your updates when you press "save"?

That's not currently possible, but could be implemented I guess.  You'd basically need to modify the state machine in  client.js.  So the default state behaves more like AwaitingWithBuffer (which queues up a buffer of operations) rather than Synchronized (which sends new operations immediately) and then plumb in a mechanism to flush the buffer.  It'll be a bit tricky and you'll have to deal with all the state transitions (such as the user pressing save and then pressing it again before the first save completes).

If you decide to give it a go and have questions, let me know.

-Michael

Reply all
Reply to author
Forward
0 new messages