RN: Support Multiple Packager Servers

Summary:
Adds support for multiple packager servers, which could be used to hot-reload dependencies in response to a change in the `cacheVersion`.

Currently, there is no way to:

- Create multiple `ReactPackager` servers.
- Instantiate more than one `FileWatcher` constructor (due to the "single instance" invariant).

public

Reviewed By: martinbigio

Differential Revision: D2713455

fb-gh-sync-id: 9be0f0cb2b846baf088d0cf14650cc8b9e950815
This commit is contained in:
Tim Yung 2015-12-02 18:57:20 -08:00 committed by facebook-github-bot-0
parent d6dc12e551
commit c68fa4b4d8
2 changed files with 2 additions and 0 deletions

View File

@ -16,6 +16,7 @@ var debug = require('debug');
var omit = require('underscore').omit;
var Activity = require('./src/Activity');
exports.createServer = createServer;
exports.middleware = function(options) {
var server = createServer(options);
return server.processRequest.bind(server);

View File

@ -72,6 +72,7 @@ class FileWatcher extends EventEmitter {
}
end() {
inited = false;
return this._loading.then(
(watchers) => watchers.map(
watcher => Promise.denodeify(watcher.close).call(watcher)