Code Monkey home page Code Monkey logo

Comments (5)

Yuyz0112 avatar Yuyz0112 commented on August 22, 2024

Just read the description and the commits about media support, it looks nice. I Still need some time to think about this carefully, but the following points may be considered as a design principle:

  1. It will be nice if the data structure is similar to the node's original data interface, so the serializer will be more transparent to the developer.
  2. It is important to have a data structure with less overhead, I know there is a trade-off about namespace or abstraction, but still need to be careful here.

Currently, the special cases you've mentioned are following these rules, like only add a flag when it really needs, or re-use the attributes object to store some internal attributes. However, there are absolutely some spaces to improve, but if there is a breaking change, we need to do that ASAP before someone use rrweb in production heavily:)

from rrweb.

Yuyz0112 avatar Yuyz0112 commented on August 22, 2024

How about using a properties key to store these states?

from rrweb.

DvdGiessen avatar DvdGiessen commented on August 22, 2024

A properties key would be similar to the mediaState object I used, reusable for properties from all types of DOM objects. I think keeping it typed would be nice to have.

However, I'm not entirely sure that provides the extensibility I meant. A bit like the width and height: While storing them as strings in custom-named attributes works, it feels like a bit of a hack. So, I meant, if we're going to add new arbitrary, typed, possible composit values in the future, what is the preferred way to store them? A properties key only addresses DOM object properties.

I think "we add new keys" is a acceptable answer to that question. But I want to make sure that we agree that is the way to do it, since in the README you mentioned wanting to have a stable data structure for v1.0, and it also implies we'll from now on have to deal with new/missing keys for compatibility between different versions and cannot make any of these keys required in the typedef.

from rrweb.

Yuyz0112 avatar Yuyz0112 commented on August 22, 2024

@DvdGiessen Yes I agree with this and now you can add new keys without considering about compatibility.

cannot make any of these keys required in the typedef

This will be true after v1.0 is released.

from rrweb.

DvdGiessen avatar DvdGiessen commented on August 22, 2024

Alright, I'll update and my media branch to include this.

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.