Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: Finalise and complete the modify methods #147

Closed
dxinteractive opened this issue Nov 27, 2018 · 1 comment
Closed

Add: Finalise and complete the modify methods #147

dxinteractive opened this issue Nov 27, 2018 · 1 comment

Comments

@dxinteractive
Copy link
Collaborator

dxinteractive commented Nov 27, 2018

Kinda sorta proposed API

modifyDown() and modifyUp()

simple value-in value-out like ii => ii * 2

parcel
    .modifyDown(num => `${num}`)
    .modifyUp(str => Number(num))

modifyShapeDown() and modifyShapeUp()

Gives you a StaticParcel (immutable.js-like parcel that doesnt have the two way binding), expects a StaticParcel to be returned.

parcel.modifyShapeDown(staticParcel => staticParcel
    .push(123)
    .push(456)
    .setMeta({abc: 789})
);

modifyChange()

Gives you a parcel and a change request, diy action editing and dispatching madness if you really need control of action order and stuff.

Modify methods

The modify methods allow you to modify the data in a parcel in the middle of a chain of parcel function calls, without affecting the parcels real value. The data can be edited on the way down, when the parcel component is rendered; or on the way up, once a change takes place and a new value is being sent back up.

Their primary usage is if you need to store one kind of value in the parcel itself, but edit

@dxinteractive dxinteractive changed the title Add Parcel.modify, Parcel.update, Parcel.modifyChange and StaticParcels Finalise and complete the modify methods Nov 27, 2018
@dxinteractive dxinteractive changed the title Finalise and complete the modify methods Add: Finalise and complete the modify methods Dec 5, 2018
@dxinteractive
Copy link
Collaborator Author

The above proposed API was changed heavily before release, please read the docs for the end result. Released in https://github.com/blueflag/dataparcels/releases/tag/v0.18.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant