Code Monkey home page Code Monkey logo

Comments (5)

Yuyz0112 avatar Yuyz0112 commented on July 2, 2024 1

@ChuckJonas Added this in #36, please let me know if you like it or not:)

from rrweb.

ChuckJonas avatar ChuckJonas commented on July 2, 2024

Looking at my truncated attempts I think the problem is that my event are all EventType. IncrementalSnapshot.

So maybe this would be possible if I somehow was able to incrementally restart with EventType. FullSnapshot?

Seems like I could achieve something similar by just having 2-3 offset & restarting rrweb.record instances running at once, but since there is no way to stop recording (#16), I'm sure this is not a good idea.

from rrweb.

Yuyz0112 avatar Yuyz0112 commented on July 2, 2024

I think the stop recording ability can let you have a workaround solution. But it will be better if we add a take a full snapshot after N incremental snapshot option, is that what you need?

For example, take a full snapshot after 5 incremental snapshots will give you a snapshot chain like this:

FS1 -> IS1 -> ... -> IS5 -> FS2 -> IS6 -> ... -> IS10 -> FS3 -> ...

So you can replay from the latest full snapshot and drop the previous snapshots if you do not need them.

from rrweb.

ChuckJonas avatar ChuckJonas commented on July 2, 2024

@Yuyz0112
The latter solution you proposed could work for my use case. My only concern is that it might be tricky to balance performance due to variable activity (if the user was generating lots of events vs none at all).

I think a more robust solution would be to expose someway to trigger a full snapshot event emit yourself.

IMO, the most intuitive way of doing this would require changing the return of the record to an object (instead of just a stop function):

let recorder = rrweb.record({
  emit(event) {
    //save event
  },
});

//call recorder 'captureFullSnapshot' method every 10 sec
let fullCapture = setInterval(1000 * 10, recorder.captureFullSnapshot);

//stop after 1min
setTimeout(1000 * 60, () => { 
     recorder.stop();   
     clearInterval(fullCapture);
}); 

from rrweb.

Yuyz0112 avatar Yuyz0112 commented on July 2, 2024

@ChuckJonas how about provides two modes?
take one full snapshot after N incremental snapshot and take one full snapshot after N ms?
Expose something like captureFullsnapshot may look too low-level for most of the developers.

from rrweb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.