'use strict';
var escapeTextContentForBrowser = require('react/lib/escapeTextContentForBrowser');
var assign = require('lodash.assign');
var JSONComponentEnvironment = require('./json-component-environment');
var JSONTextComponent = function JSONTextComponent() {};
var Mixin = {
construct: function construct(text) {
this._currentElement = text;
this._stringText = String(text);
this._rootNodeID = null;
this._mountIndex = 0;
},
mountComponent: function mountComponent() {
return escapeTextContentForBrowser(this._stringText);
},
receiveComponent: function receiveComponent(nextText) {
this._currentElement = nextText;
},
unmountComponent: function unmountComponent() {
JSONComponentEnvironment.unmountIDFromEnvironment(this._rootNodeID);
}
};
assign(JSONTextComponent.prototype, Mixin);
module.exports = JSONTextComponent; |