mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Use browser-refresh-client instead
This commit is contained in:
parent
2a60052226
commit
58e0ecd1cc
@ -1,28 +1,23 @@
|
||||
var enabled = false;
|
||||
var browserRefreshClient = require('browser-refresh-client');
|
||||
|
||||
exports.enable = function() {
|
||||
if (!browserRefreshClient.isBrowserRefreshEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
enabled = true;
|
||||
|
||||
if (process.env.BROWSER_REFRESH_URL) {
|
||||
var modifiedEvent = 'marko.fileModified';
|
||||
|
||||
process.send({
|
||||
type: 'browser-refresh.specialReload',
|
||||
pattern: '*.marko marko-taglib.json marko-tag.json',
|
||||
modifiedEvent: modifiedEvent
|
||||
});
|
||||
|
||||
var hotReload = require('../hot-reload');
|
||||
hotReload.enable();
|
||||
|
||||
process.on('message', function(m) {
|
||||
if (typeof m === 'object' && m.type === modifiedEvent) {
|
||||
hotReload.handleFileModified(m.path);
|
||||
}
|
||||
browserRefreshClient
|
||||
.enableSpecialReload('*.marko marko-taglib.json marko-tag.json')
|
||||
.onFileModified(function(path) {
|
||||
hotReload.handleFileModified(path);
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -21,6 +21,7 @@
|
||||
"dependencies": {
|
||||
"app-module-path": "^1.0.0",
|
||||
"async-writer": "^1.1.2",
|
||||
"browser-refresh-client": "^1.0.0",
|
||||
"char-props": "~0.1.5",
|
||||
"events": "^1.0.2",
|
||||
"htmlparser2": "^3.7.2",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user