[react-packager] Remove horribly outdated example_project
Summary: Removes some old unused code.
This commit is contained in:
parent
5cad2e9370
commit
abce124198
|
@ -1,12 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule bar
|
||||
*/
|
||||
|
||||
module.exports = setInterval;
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"port": 3000,
|
||||
"devPort": 3001,
|
||||
"publicDir": "./public",
|
||||
"rootPath": "../example_project",
|
||||
"moduleOptions": {
|
||||
"format": "haste",
|
||||
"main": "index.js"
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule foo
|
||||
*/
|
||||
|
||||
|
||||
var bar = require('bar');
|
||||
|
||||
class Logger {
|
||||
log() {
|
||||
console.log('youll have to change me lol');
|
||||
}
|
||||
}
|
||||
|
||||
class SecretLogger extends Logger {
|
||||
log(secret) {
|
||||
console.log('logging ', secret);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = (secret) => {
|
||||
if (secret !== 'secret') throw new Error('wrong secret');
|
||||
bar(new SecretLogger().log.bind(SecretLogger, secret), 400);
|
||||
};
|
|
@ -1,16 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule index
|
||||
*/
|
||||
|
||||
require('main');
|
||||
require('code');
|
||||
|
||||
var foo = require('foo');
|
||||
foo('secret');
|
|
@ -1,53 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule Channel
|
||||
*/
|
||||
|
||||
var XHR = require('XHR');
|
||||
|
||||
/**
|
||||
* Client implementation of a server-push channel.
|
||||
*
|
||||
* @see Channel.js for full documentation
|
||||
*/
|
||||
var channel = null, at = null, delay = 0;
|
||||
var Channel = {};
|
||||
|
||||
Channel.connect = function() {
|
||||
var url = '/pull';
|
||||
if (channel) {
|
||||
url += '?channel=' + channel + '&at=' + at;
|
||||
}
|
||||
XHR.get(url, function(err, xhr) {
|
||||
if (err) {
|
||||
delay = Math.min(Math.max(1000, delay * 2), 30000);
|
||||
} else {
|
||||
var res = xhr.responseText;
|
||||
res = JSON.parse(res);
|
||||
|
||||
delay = 0;
|
||||
|
||||
// Cache channel state
|
||||
channel = res.channel;
|
||||
at = res.at;
|
||||
|
||||
var messages = res.messages;
|
||||
messages.forEach(function(message) {
|
||||
var ev = document.createEvent('CustomEvent');
|
||||
ev.initCustomEvent(message.event, true, true, message.detail);
|
||||
window.dispatchEvent(ev);
|
||||
});
|
||||
}
|
||||
|
||||
// Reconnect
|
||||
setTimeout(Channel.connect, delay);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = Channel;
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule XHR
|
||||
*/
|
||||
|
||||
function request(method, url, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open(method, url);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status === 200) {
|
||||
callback(null, xhr);
|
||||
} else {
|
||||
callback(new Error('status = ' + xhr.status, xhr));
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
exports.get = function(url, callback) {
|
||||
request('GET', url, callback);
|
||||
};
|
|
@ -1,58 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule code
|
||||
*/
|
||||
var XHR = require('XHR');
|
||||
|
||||
var $ = function(sel) {return document.querySelector(sel);};
|
||||
|
||||
function getListItems(files) {
|
||||
var items = [];
|
||||
files.forEach(function(file) {
|
||||
var displayName = file.name + (file.type == 1 ? '/' : '');
|
||||
items.push(
|
||||
React.DOM.li({
|
||||
className: 'type' + file.type,
|
||||
key: file.ino
|
||||
}, displayName)
|
||||
);
|
||||
if (file.type === 1) {
|
||||
items.push(getListItems(file.nodes));
|
||||
}
|
||||
});
|
||||
|
||||
return React.DOM.ol(null, items);
|
||||
}
|
||||
|
||||
var FileList = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {files: []};
|
||||
},
|
||||
|
||||
componentDidMount: function() {
|
||||
XHR.get(
|
||||
this.props.source,
|
||||
function(err, xhr) {
|
||||
if (err) {throw err;}
|
||||
|
||||
var files = JSON.parse(xhr.responseText);
|
||||
this.setState({files: files});
|
||||
}.bind(this)
|
||||
);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return getListItems(this.state.files);
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
React.render(React.createElement(FileList, {source: '/files'}),
|
||||
$('#code'));
|
||||
});
|
|
@ -1,64 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule main
|
||||
*/
|
||||
var Channel = require('Channel');
|
||||
|
||||
function toArray(arr) {return Array.prototype.slice.apply(arr);}
|
||||
function $(sel) {return document.querySelector(sel);}
|
||||
function $$(sel) {return toArray(document.querySelectorAll(sel));}
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
function channelLog() {
|
||||
var args = Array.prototype.slice.apply(arguments);
|
||||
var ts = new Date();
|
||||
var el = document.createElement('li');
|
||||
args.unshift(ts.getHours() + ':' +
|
||||
('0' + ts.getMinutes()).substr(0,2) + ':' +
|
||||
('0' + ts.getSeconds()).substr(0,2));
|
||||
el.className = 'console-entry';
|
||||
el.innerHTML = args.join(' ');
|
||||
$('#console').appendChild(el);
|
||||
el.scrollIntoView();
|
||||
}
|
||||
|
||||
global.addEventListener('ChannelInit', function(event) {
|
||||
$('#console').innerHTML = '';
|
||||
channelLog(event.type);
|
||||
});
|
||||
|
||||
global.addEventListener('ChannelLog', function(event) {
|
||||
channelLog.apply(null, event.detail);
|
||||
});
|
||||
|
||||
// Tab pane support
|
||||
function showTab(paneId) {
|
||||
paneId = paneId.replace(/\W/g, '');
|
||||
if (paneId) {
|
||||
$$('#nav-panes > div').forEach(function(pane) {
|
||||
pane.classList.toggle('active', pane.id === paneId);
|
||||
});
|
||||
$$('#nav-tabs li').forEach(function(tab) {
|
||||
tab.classList.toggle('active',
|
||||
tab.getAttribute('data-pane') === paneId);
|
||||
});
|
||||
global.history.replaceState(null, null, '#' + paneId);
|
||||
}
|
||||
}
|
||||
|
||||
$('#nav-tabs').onclick = function(e) {
|
||||
showTab(e.target.getAttribute('data-pane'));
|
||||
};
|
||||
|
||||
// Show current pane
|
||||
showTab(location.hash);
|
||||
|
||||
// Connect to server-push channel
|
||||
Channel.connect();
|
||||
});
|
|
@ -1,104 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
|
||||
html {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
body {
|
||||
margin-right: 200px
|
||||
}
|
||||
|
||||
#nav-tabs {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
background-color: #eee;
|
||||
border-bottom: solid 1px black;
|
||||
font-size: 10pt;
|
||||
font-weight: bold;
|
||||
vertical-align: bottom;
|
||||
line-height: 20px;
|
||||
height: 29px;
|
||||
}
|
||||
#nav-tabs li {
|
||||
padding: 0 10px;
|
||||
margin: 0;
|
||||
border-bottom-width: 0;
|
||||
display:inline-block;
|
||||
cursor: pointer;
|
||||
line-height: 29px;
|
||||
}
|
||||
#nav-tabs li:first-child {
|
||||
color: #666;
|
||||
}
|
||||
#nav-tabs li.active {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
#nav-panes {
|
||||
position: absolute;
|
||||
top: 30px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
scroll: auto;
|
||||
overflow: auto;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
#nav-panes .pane {
|
||||
display: none;
|
||||
}
|
||||
#nav-panes .active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.pane {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#console {
|
||||
padding-left: 5px;
|
||||
}
|
||||
#console li {
|
||||
font-size: 10pt;
|
||||
font-family: monospace;
|
||||
white-space: nowrap;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#code > ol {
|
||||
font-size: 10pt;
|
||||
font-family: monospace;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
#code ol ol {
|
||||
margin-left: 1em;
|
||||
padding-left: 1em;
|
||||
border-left: dashed 1px #ddd;
|
||||
}
|
||||
#code li {
|
||||
color: #000;
|
||||
font-weight: normal;
|
||||
list-style: none;
|
||||
line-height: 1.2em;
|
||||
}
|
||||
#code .type1 {
|
||||
color: #009;
|
||||
}
|
||||
#code .type2 {
|
||||
color: #909;
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright (c) 2015-present, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the BSD-style license found in the
|
||||
LICENSE file in the root directory of this source tree. An additional grant
|
||||
of patent rights can be found in the PATENTS file in the same directory.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="css/index.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<ul id="nav-tabs">
|
||||
<li data-pane="main">JS App Server</li>
|
||||
<li data-pane="console">Console</li>
|
||||
<li data-pane="code">Code</li>
|
||||
<li data-pane="activity">Activity</li>
|
||||
</ul>
|
||||
|
||||
<div id="nav-panes">
|
||||
<div id="main" class="pane">
|
||||
<p>Welcome to the react packager project.</p>
|
||||
<a href="http://localhost:3000/resource?path=index.js">Get example index.js package</a>
|
||||
</div>
|
||||
|
||||
<div id="console" class="pane"></div>
|
||||
<div id="code" class="pane"></div>
|
||||
<div id="activity" class="pane">react packager tasks in progress</div>
|
||||
</div>
|
||||
|
||||
<script src="http://fb.me/react-0.12.0.js"></script>
|
||||
<script src="http://localhost:3000/resource?path=index.js"></script>
|
||||
<script type="text/javascript">require('index');</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue