Giter Site home page Giter Site logo

关于对象丢失的问题 about dob HOT 6 CLOSED

dobjs avatar dobjs commented on May 21, 2024
关于对象丢失的问题

from dob.

Comments (6)

ascoders avatar ascoders commented on May 21, 2024
a.b.$raw === b // true

使用 $raw 访问到真实对象引用,否则是代理。

from dob.

FishOrBear avatar FishOrBear commented on May 21, 2024

比较奇怪的是 B类并未被监听,为何返回的b对象会是代理呢。

from dob.

ascoders avatar ascoders commented on May 21, 2024

@FishOrBear 因为 A 类是 observable 的,a.setB(b) 就会将 a 中的 b 变成 observable

A 类只要是被 observable 装饰,所有内部数据都是被监听的。

from dob.

FishOrBear avatar FishOrBear commented on May 21, 2024

@ascoders
还有一个问题, 这样会导致 a instanceof A 失效

from dob.

ascoders avatar ascoders commented on May 21, 2024

确实,因为 a 是一个 proxy,不过数据流场景应该使用不到吧。

请问有 a instanceof A 这种场景吗?

from dob.

FishOrBear avatar FishOrBear commented on May 21, 2024

@ascoders 对我来说 会有这个情况 可能使用场景的问题吧..

from dob.

Related Issues (10)

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.