All Downloads are FREE. Search and download functionalities are using the official Maven repository.

webapp.js.app.jsx Maven / Gradle / Ivy

The newest version!
var ReactDOM = require("react-dom");
var React = require("react");

function loadJSON(callback) {   

	var xobj = new XMLHttpRequest();
		xobj.overrideMimeType("application/json");
	xobj.open('GET', './diffs/report.json', true); // Replace 'my_data' with the path to your file
	xobj.onreadystatechange = function () {
		  if (xobj.readyState == 4 && xobj.status == "200") {
			// Required use of an anonymous callback as .open will NOT return a value but simply returns undefined in asynchronous mode
			callback(xobj.response);
		  }
	};
	xobj.send(null);  
 }

var State = React.createClass({
	componentDidMount: function() {
		console.log(this.refs.iframe.contentWindow);
	    this.refs.iframe.addEventListener("load", (function(e) {
	    	console.log(e);
	    	e.target.contentWindow.onscroll = this.props.handleScroll;
	    	console.log(e.target.contentWindow);
	    }).bind(this));
	},

	render: function() {
		return