@@ -78,8 +78,6 @@ module.hot.status() // Will return one of the following strings...
78
78
| ----------- | -------------------------------------------------------------------------------------- |
79
79
| idle | The process is waiting for a call to ` check ` (see below) |
80
80
| check | The process is checking for updates |
81
- | watch | The process is in watch mode and will be automatically notified about changes |
82
- | watch-delay | Delaying for a specified time after the initial change to allow for any other updates |
83
81
| prepare | The process is getting ready for the update (e.g. downloading the updated module) |
84
82
| ready | The update is prepared and available |
85
83
| dispose | The process is calling the ` dispose ` handlers on the modules that will be replaced |
@@ -93,27 +91,60 @@ module.hot.status() // Will return one of the following strings...
93
91
Test all loaded modules for updates and, if updates exist, ` apply ` them.
94
92
95
93
``` js
96
- module .hot .check (autoApply, (error , outdatedModules ) => {
97
- // Catch errors and outdated modules...
98
- })
94
+ module .hot .check (autoApply).then (outdatedModules => {
95
+ // outdated modules...
96
+ }).catch (error => {
97
+ // catch errors
98
+ });
99
99
```
100
100
101
101
The ` autoApply ` parameter can either be a boolean or ` options ` to pass to the ` apply ` method when called.
102
102
103
103
104
104
### ` apply `
105
105
106
- Continue the update process (as long as `module.hot.status() === 'ready').
106
+ Continue the update process (as long as ` module.hot.status() === 'ready' ` ).
107
107
108
108
``` js
109
- module .hot .apply (options, (error , outdatedModules ) => {
110
- // Catch errors and outdated modules...
111
- })
109
+ module .hot .apply (options).then (outdatedModules => {
110
+ // outdated modules...
111
+ }).catch (error => {
112
+ // catch errors
113
+ });
112
114
```
113
115
114
116
The optional ` options ` object can include the following properties:
115
117
116
- - ` ignoreUnaccepted ` (boolean): Continue the update process even if some modules are not accepted.
118
+ - ` ignoreUnaccepted ` (boolean): Ignore changes made to unaccepted modules.
119
+ - ` ignoreDeclined ` (boolean): Ignore changes made to declined modules.
120
+ - ` ignoreErrored ` (boolean): Ignore errors throw in accept handlers, error handlers and while reevaulating module.
121
+ - ` onDeclined ` (function(info)): Notifier for declined modules
122
+ - ` onUnaccepted ` (function(info)): Notifier for unaccepted modules
123
+ - ` onAccepted ` (function(info)): Notifier for accepted modules
124
+ - ` onDisposed ` (function(info)): Notifier for disposed modules
125
+ - ` onErrored ` (function(info)): Notifier for errors
126
+
127
+ The ` info ` parameter will be an object containing some of the following values:
128
+
129
+ ``` js
130
+ {
131
+ type: " self-declined" | " declined" |
132
+ " unaccepted" | " accepted" |
133
+ " disposed" | " accept-errored" |
134
+ " self-accept-errored" | " self-accept-error-handler-errored" ,
135
+ moduleId: 4 , // The module in question.
136
+ dependencyId: 3 , // For errors: the module id owning the accept handler.
137
+ chain: [1 , 2 , 3 , 4 ], // For declined/accepted/unaccepted: the chain from where the update was propagated.
138
+ parentId: 5 , // For declined: the module id of the declining parent
139
+ outdatedModules: [1 , 2 , 3 , 4 ], // For accepted: the modules that are outdated and will be disposed
140
+ outdatedDependencies: { // For accepted: The location of accept handlers that will handle the update
141
+ 5 : [4 ]
142
+ },
143
+ error: new Error (... ), // For errors: the thrown error
144
+ originalError: new Error (... ) // For self-accept-error-handler-errored:
145
+ // the error thrown by the module before the error handler tried to handle it.
146
+ }
147
+ ```
117
148
118
149
119
150
### ` addStatusHandler `
0 commit comments