Updates from Wed 29 Apr

This commit is contained in:
Ben Alpert 2015-04-29 18:55:07 -07:00
commit ff53859b52
4 changed files with 29 additions and 65 deletions

View File

@ -213,7 +213,8 @@ function runServer(
.use(openStackFrameInEditor) .use(openStackFrameInEditor)
.use(getDevToolsLauncher(options)) .use(getDevToolsLauncher(options))
.use(statusPageMiddleware) .use(statusPageMiddleware)
.use(getFlowTypeCheckMiddleware(options)) // Temporarily disable flow check until it's more stable
//.use(getFlowTypeCheckMiddleware(options))
.use(getAppMiddleware(options)); .use(getAppMiddleware(options));
options.projectRoots.forEach(function(root) { options.projectRoots.forEach(function(root) {

View File

@ -3,53 +3,14 @@
* *
* @provides Array.prototype.es6 * @provides Array.prototype.es6
* @polyfill * @polyfill
* @requires __DEV__
*/ */
/*eslint-disable */ /*eslint-disable */
/*jslint bitwise: true */ /*jslint bitwise: true */
(function (undefined) { (function(undefined) {
if (__DEV__) {
// Define DEV-only setter that blows up when someone incorrectly
// iterates over arrays.
try {
Object.defineProperty && Object.defineProperty(
Array.prototype,
'__ARRAY_ENUMERATION_GUARD__',
{
configurable: true,
enumerable: true,
get: function() {
console.error(
'Your code is broken! Do not iterate over arrays with ' +
'for...in.'
);
}
}
);
} catch (e) {
// Nothing
}
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex
function findIndex(predicate, context) { function findIndex(predicate, context) {
/**
* Why am I seeing this "findIndex" method as a value in my array!?
*
* We polyfill the "findIndex" method -- called like
* `[1, 2, 3].findIndex(1)` -- for older browsers. A side effect of the way
* we do that is that the method is enumerable. If you were incorrectly
* iterating over your array using the object property iterator syntax
* `for (key in obj)` you will see the method name "findIndex" as a key.
*
* To fix your code please do one of the following:
*
* - Use a regular for loop with index.
* - Use one of the array methods: a.forEach, a.map, etc.
* - Guard your body of your loop with a `arr.hasOwnProperty(key)` check.
*/
if (this == null) { if (this == null) {
throw new TypeError( throw new TypeError(
'Array.prototype.findIndex called on null or undefined' 'Array.prototype.findIndex called on null or undefined'
@ -69,32 +30,29 @@
} }
if (!Array.prototype.findIndex) { if (!Array.prototype.findIndex) {
Array.prototype.findIndex = findIndex; Object.defineProperty(Array.prototype, 'findIndex', {
enumerable: false,
writable: true,
configurable: true,
value: findIndex
});
} }
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
if (!Array.prototype.find) { if (!Array.prototype.find) {
Array.prototype.find = function(predicate, context) { Object.defineProperty(Array.prototype, 'find', {
/** enumerable: false,
* Why am I seeing this "find" method as a value in my array!? writable: true,
* configurable: true,
* We polyfill the "find" method -- called like value: function(predicate, context) {
* `[1, 2, 3].find(1)` -- for older browsers. A side effect of the way if (this == null) {
* we do that is that the method is enumerable. If you were incorrectly throw new TypeError(
* iterating over your array using the object property iterator syntax 'Array.prototype.find called on null or undefined'
* `for (key in obj)` you will see the method name "find" as a key. );
* }
* To fix your code please do one of the following: var index = findIndex.call(this, predicate, context);
* return index === -1 ? undefined : this[index];
* - Use a regular for loop with index.
* - Use one of the array methods: a.forEach, a.map, etc.
* - Guard your body of your loop with a `arr.hasOwnProperty(key)` check.
*/
if (this == null) {
throw new TypeError('Array.prototype.find called on null or undefined');
} }
var index = findIndex.call(this, predicate, context); });
return index === -1 ? undefined : this[index];
};
} }
})(); })();

View File

@ -26,7 +26,7 @@ var detectingWatcherClass = new Promise(function(resolve) {
module.exports = FileWatcher; module.exports = FileWatcher;
var MAX_WAIT_TIME = 10000; var MAX_WAIT_TIME = 25000;
// Singleton // Singleton
var fileWatcher = null; var fileWatcher = null;

View File

@ -34,7 +34,12 @@ function attachToServer(server, path) {
ws.on('message', function(message) { ws.on('message', function(message) {
allClientsExcept(ws).forEach(function(cn) { allClientsExcept(ws).forEach(function(cn) {
cn.send(message); try {
// Sometimes this call throws 'not opened'
cn.send(message);
} catch(e) {
console.warn('WARN: ' + e.message);
}
}); });
}); });
}); });