Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no sync event on SB or Model? #53

Open
jacobbubu opened this issue Oct 24, 2019 · 3 comments
Open

There is no sync event on SB or Model? #53

jacobbubu opened this issue Oct 24, 2019 · 3 comments

Comments

@jacobbubu
Copy link

in the chapter Persistence of readme.markdown, the example is following:

var m = new Model()

//stream TO disk.
m.on('sync', function () {
  m.createReadStream().pipe(fs.createWriteStream(file))
})

I've not found sync event neither in 'index.js' nor 'model.js'

@dominictarr
Copy link
Owner

sync is emitted in the core Scuttlebutt code, for example here:

if(syncRecv) outer.emit('sync'), outer.emit('synced')

@dominictarr
Copy link
Owner

I havn't touched or used this in 5 years, so I can't remember all the details of how this worked internally. I just searched for the word emit('sync' and found that.

@jacobbubu
Copy link
Author

I havn't touched or used this in 5 years, so I can't remember all the details of how this worked internally. I just searched for the word emit('sync' and found that.

Actually, sync only exists on stream, not model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants