mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Handle case where a template was loaded before hot-reload was enabled
This commit is contained in:
parent
4b6a8dfed9
commit
c317d0d536
@ -28,10 +28,12 @@ exports.enable = function() {
|
|||||||
Template.prototype[k] = function() {
|
Template.prototype[k] = function() {
|
||||||
if (this.__hotReloadModifiedFlag !== modifiedFlag) {
|
if (this.__hotReloadModifiedFlag !== modifiedFlag) {
|
||||||
var path = this.__hotReloadPath;
|
var path = this.__hotReloadPath;
|
||||||
|
if (path) {
|
||||||
// Reload the template
|
// Reload the template
|
||||||
var template = runtime.load(path);
|
var template = runtime.load(path);
|
||||||
extend(this, template);
|
extend(this, template);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
oldMethod.apply(this, arguments);
|
oldMethod.apply(this, arguments);
|
||||||
};
|
};
|
||||||
@ -41,7 +43,7 @@ exports.enable = function() {
|
|||||||
|
|
||||||
var oldLoad = runtime.load;
|
var oldLoad = runtime.load;
|
||||||
|
|
||||||
runtime.load = function browserRefreshLoad(path) {
|
runtime.load = function hotReloadLoad(path) {
|
||||||
if (!path) {
|
if (!path) {
|
||||||
throw new Error('Invalid path');
|
throw new Error('Invalid path');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user