Open hypesystem opened 9 years ago
This would be a breaking change... maybe we should add a branch for breaking changes that will be merged into master at 1.0?
it would make sense if there was also a set function doing pretty much what we do now, but for any value:
//Overwrite data field
message.set("data", {
knownValue: "atSomePoint",
otherValue: "theseOverwriteEverythingPreviouslySet"
});
//Set new value for one of the parameters sent to gcm
message.set("collapseKey", "newCollapseKey");
If data
gets its own addData
method, notification
should have the same:
message.addNotificationField("title", "Hello, World");
It seems misleading that the reference to the data object is overwritten with whatever is given to
addDataWithObject
.A more sensical way to do it, would be to merge the two objects, overwriting any values that were already present.
This would allow known values to be set at time of construction, and later values to be added after: