medikoo / medikoo/dbjs

Improve object destruction handling

Open
#59 0 comments 0 reactions 1 assignee View on GitHub

@medikoo is already working on this.

Since May 2, 2016.

Dominant language
JavaScript
Stars
27
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Currently when object is destructed, all property values are deleted, it's prototype is changed to db.Base.prototype and emitters for all property changes emit with new values (undefined).

Cleaner probably would be to:

  • Detach observers from properties (so clean all listeners from property observers)
  • Downgrade object prototype (that should result with some events, e.g. object removed from instances set).

Above should also allow to produce configuration that's scalable in sense that some objects can be permanently cleared and even re-added. It can be agreed that once destroyed object is never resurrected with same object instance, but new one is created if such action is desired.

We should also be able to distinguish two actions:

  • Deletion of object, in such aside of object being destroyed, the records that remove all properties and object itself should also be propagated with (persistent db) events
  • Remove of object from memory. It should be pure removal from memory, no persistent db events, just memory events that concern object visibility should be propagated

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.