mirror of https://github.com/status-im/metro.git
file change listener for relay fragments in packager server
Reviewed By: martinbigio Differential Revision: D3011797 fb-gh-sync-id: 9f7ddc7b3c0c0e2a78db829343d9fa93a46b4ad6 shipit-source-id: 9f7ddc7b3c0c0e2a78db829343d9fa93a46b4ad6
This commit is contained in:
parent
cccbb342a0
commit
4ea783234b
|
@ -217,6 +217,12 @@ class Server {
|
|||
this._hmrFileChangeListener = listener;
|
||||
}
|
||||
|
||||
addFileChangeListener(listener) {
|
||||
if (this._fileChangeListeners.indexOf(listener) === -1) {
|
||||
this._fileChangeListeners.push(listener);
|
||||
}
|
||||
}
|
||||
|
||||
buildBundle(options) {
|
||||
return Promise.resolve().then(() => {
|
||||
if (!options.platform) {
|
||||
|
@ -288,6 +294,15 @@ class Server {
|
|||
return;
|
||||
}
|
||||
|
||||
Promise.all(
|
||||
this._fileChangeListeners.map(listener => listener(absPath))
|
||||
).then(
|
||||
() => this._onFileChangeComplete(absPath),
|
||||
() => this._onFileChangeComplete(absPath)
|
||||
);
|
||||
}
|
||||
|
||||
_onFileChangeComplete(absPath) {
|
||||
// Make sure the file watcher event runs through the system before
|
||||
// we rebuild the bundles.
|
||||
this._debouncedFileChangeHandler(absPath);
|
||||
|
|
Loading…
Reference in New Issue