]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: add missing isReady breaking change
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 8 Sep 2020 12:11:28 +0000 (14:11 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 8 Sep 2020 12:11:28 +0000 (14:11 +0200)
docs/guide/migration/index.md

index 934fda3b242ca62be5a5c09a38256e619fe866bb..66447201837bb92a9ebe4c6ca39a1d106ab0366c 100644 (file)
@@ -168,6 +168,26 @@ router.resolve({
 
 **Reason**: Vue Router doesn't use `path-to-regexp` anymore, instead it implements its own parsing system that allows route ranking and enables dynamic routing. Since we usually add one single catch-all route per project, there is no big benefit in supporting a special syntax for `*`.
 
+### Replaced `onReady` with `isReady`
+
+The existing `router.onReady()` function has been replaced with `router.isReady()` which doesn't take any argument and returns a Promise:
+
+```js
+// replace
+router.onReady(onSuccess, onError)
+// with
+router.isReady().then(onSuccess).catch(onError)
+// or use await:
+try {
+  await router.isReady()
+  // onSuccess
+} catch (err) {
+  // onError
+}
+```
+
+**Reason**: As Promises become available in all major browsers, we try to natively integrate them in Vue Router's API.
+
 ### Removal of `router.match` and changes to `router.resolve`
 
 Both `router.match`, and `router.resolve` have been merged together into `router.resolve` with a slightly different signature. [Refer to the API](#TODO) for more details.