-
Notifications
You must be signed in to change notification settings - Fork 45
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
FLUID-6158: Document fluid.modelPairToChanges() #122
Changes from 1 commit
088e54a
09597e8
6c67d89
211eed5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -539,6 +539,22 @@ if you are interested. | |
path segments representing this | ||
* `newValue: {Any}` The value to be written into `model` at the path `path` | ||
|
||
### fluid.modelPairToChanges(value, oldValue, changePathPrefix) | ||
|
||
* `value {Any}` Model value to compare | ||
* `oldValue {Any}` Model value to compare | ||
* `changePathPrefix {String|Array of String}` [optional] Path prefix to prepend to change record paths | ||
* Returns: `{Array of Object}` An array of change records | ||
|
||
Calculates the changes between the model values `value` and `oldValue` | ||
and returns an array of change records. The optional argument | ||
`changePathPrefix` is prepended to the change path of each record (this | ||
is useful for generating change records to be applied at a non-root path | ||
in a model). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be really useful to have a super-simple example here that might allow people to get a sense of what is going on - for example, a computation of the changes between {a: 1} and {b:2} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great suggestion. Done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great example, very clear |
||
|
||
The returned array of change records may be used with | ||
`fluid.fireChanges()`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This API isn't actually documented - I wonder if I could prevail on you to add some basic docs for it in ChangeApplierAPI.md at the end of the section "Programmatic style for triggering a change" and then link to it here - cheers! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this comment got displaced through collateral changes - do you think it seems doable? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, absolutely. I will add docs for fluid.fireChanges. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
### fluid.model.parseEL(EL) | ||
|
||
* `EL {String}` The EL path to be parsed | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type should really read {Array of changeRecord} and link to the section in ChangeApplierAPI which defines it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I was incorrect in referring to the output as "change records". Looking at the ChangeApplierAPI docs, I think they are changeRequest objects, because I output "path" properties rather than "changePath" properties. Does this seem right?
I've updated the docs to read "changeRequest" and added a link to the docs for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is brilliant, thanks!