Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/core/RemarkupMetadata.js
- This file was added.
/** | |||||
* @requires javelin-install | |||||
* javelin-dom | |||||
* javelin-json | |||||
* @provides phabricator-remarkup-metadata | |||||
* @javelin | |||||
*/ | |||||
JX.install('RemarkupMetadata', { | |||||
construct: function(metadataValue, metadataID) { | |||||
if (JX.RemarkupMetadata._metadataValue == null) { | |||||
JX.RemarkupMetadata._metadataValue = []; | |||||
JX.RemarkupMetadata._metadataValue[metadataID] = metadataValue; | |||||
} else if (!JX.RemarkupMetadata._metadataValue.hasOwnProperty(metadataID)) { | |||||
JX.RemarkupMetadata._metadataValue[metadataID] = metadataValue; | |||||
} | |||||
valerio.bozzolan: Thanks. In short, this is the proposed change. Taking this:
```
if (JX.RemarkupMetadata. | |||||
valerio.bozzolanUnsubmitted Done Inline ActionsHi @Dylsss do you agree with the inline comments here? You can also say "Yeah I don't care" ihih and I will amend that for you, no problem valerio.bozzolan: Hi @Dylsss do you agree with the inline comments here?
You can also say "Yeah I don't care"… | |||||
this._metadataNode = JX.$(metadataID); | |||||
this._metadataID = metadataID; | |||||
}, | |||||
statics: { | |||||
_metadataValue: null | |||||
}, | |||||
members: { | |||||
_metadataNode: null, | |||||
_metadataID: null, | |||||
_writeMetadata: function() { | |||||
this._metadataNode.value = JX.JSON.stringify( | |||||
JX.RemarkupMetadata._metadataValue[this._metadataID]); | |||||
}, | |||||
getMetadata: function(key, default_value) { | |||||
if (JX.RemarkupMetadata._metadataValue[this._metadataID] | |||||
.hasOwnProperty(key)) { | |||||
return JX.RemarkupMetadata._metadataValue[this._metadataID][key]; | |||||
} | |||||
return default_value; | |||||
}, | |||||
setMetadata: function(key, value) { | |||||
JX.RemarkupMetadata._metadataValue[this._metadataID][key] = value; | |||||
this._writeMetadata(); | |||||
} | |||||
} | |||||
}); |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
Thanks. In short, this is the proposed change. Taking this:
And simplifying it to this:
Reasons: