all files / dist/ json-text-component.js

50% Statements 7/14
100% Branches 0/0
0% Functions 0/5
50% Lines 7/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30                                             
'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;