Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ObjectObservable, removeProperty / delete #60

Closed
eirikhm opened this Issue · 3 comments

2 participants

@eirikhm

Did not find anything related when searching, so doing a new ticket for this.

I'm trying to bind against an object which is used as a hashmap to store items. ObjectObservable currently supports setProperty. Are there any plans for removeProperty / delete?

@BorisMoore
Owner

Currently you can set to null, "" or undefined, as in setProperty("propName", null). In each case {{:propName}} will render the empty string, as it would if the propName key does not exist. I think this is sufficient for almost all scenarios.

So no current plan to have a removeProperty. Do you think it is needed?

@BorisMoore
Owner

You can also call delete a.propName yourself once you have called setProperty("propName", undefined)

Nevertheless, I will keep this open as a feature request. I don't think setProperty("propName", undefined) should delete the property automatically since some users may which to iterate through properties, including those with the value undefined. So that implies this request would be for a new API - removeProperty, which would set to undefined, and then delete...

@BorisMoore
Owner

This feature now exists: $.observable(myObject).removeProperty("propertyName") 5f815bc - Commit 54

@BorisMoore BorisMoore closed this
@BorisMoore BorisMoore added Resolved and removed After V1? labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.