Closed holl0wstar closed 5 years ago
My only comment would be to reverse the new/old param order. The main thing a person cares about when listening for an update is the new value, and then occasionally what the previous value was. So the order should be key, value, oldValue
I re-ordered them.
I lied about it being the only comment :P also needs an event doc directly before the emit()
call so it'll appear in the online docs
/**
* @event Metadatable#metadataUpdate
* @param {string} key
* @param {*} newValue
* @param {*} oldValue
*/
And in the function docblock it needs to do @fires Metadatable#metadataUpdate
Addresses #66
The only thing I was unsure about is that whenever the metadata doesn't exist,
oldVal
returns undefined, but I left as is since that could be treated as desired behavior since it's actually undefined.And excuse the typo.