Giter Club home page Giter Club logo

Comments (3)

gullerya avatar gullerya commented on August 16, 2024

Hi,
I've just tried to actually do an Object.seal on observable and it works as expected, IMHO.
Specifically, if you'll run Object.seal on observable, then:

  • no new properties may be added, TypeError thrown, as well as no existing properties may be deleted
  • any existing properties are still subject to modification and any modification of those is correctly observed and notified to listeners

I've pushed a set of tests to cover those cases. You may review them in the tests/module/test-object-generics.js and notify me if I've missed anything.

If so - is it answering your case?

from object-observer.

eubyte avatar eubyte commented on August 16, 2024

Thank you! You are right, it does work as intended. I realized that our use case required deepSeal functionality. We wrote a deepSeal() function and then did deepSeal(observable) -- everything seems to be fine now. Perhaps, building this functionality (and having an option to use it) in the core of the library is still not such a bad idea.

Thank you again for you great work!

from object-observer.

gullerya avatar gullerya commented on August 16, 2024

Must say that my inclination is to keep the object-observer focused on it's own concern - observation, and not extend it with less specific and more object-utilities-like functionalities.

Anyway, glad it worked out well for you and thanks for the feedback!

from object-observer.

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.