add more test

This commit is contained in:
tkqubo 2015-11-04 03:16:48 +09:00
parent 15469aa4df
commit 37cc265e02
2 changed files with 41 additions and 3 deletions

View File

@ -37,6 +37,44 @@ if(module.hot) {
});
}
class ModuleData {
updated: boolean;
}
if (module.hot) {
module.hot.accept((err: Error) => {
//...
});
module.hot.decline("./someModule");
module.hot.dispose((data: ModuleData) => {
data.updated = true;
// ...
});
let disposeHandler: ((data: ModuleData) => void) = data => {
// ...
};
module.hot.addDisposeHandler(disposeHandler);
module.hot.removeDisposeHandler(disposeHandler);
module.hot.check(true, (err: Error, outdatedModules: (string|number)[]) => {
// ...
});
module.hot.apply({ ignoreUnaccepted: true }, (err: Error, outdatedModules: (string|number)[]) => {
// ...
});
var status: string = module.hot.status();
let statusHandler: ((status: string) => void) = status => {
// ...
};
module.hot.status(statusHandler);
module.hot.addStatusHandler(statusHandler);
module.hot.removeStatusHandler(statusHandler);
}
var status: string = module.hot.status();

View File

@ -172,11 +172,11 @@ declare namespace __WebpackModuleApi {
/**
* If true the update process continues even if some modules are not accepted (and would bubble to the entry point).
*/
ignoreUnaccepted: boolean;
ignoreUnaccepted?: boolean;
/**
* Indicates that apply() is automatically called by check function
*/
autoApply: boolean;
autoApply?: boolean;
}
}