From: Eduardo San Martin Morote Date: Tue, 8 Sep 2020 12:11:28 +0000 (+0200) Subject: docs: add missing isReady breaking change X-Git-Tag: v4.0.0-beta.10~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4999db93a0ddb12c6c8a66dcf47d3e378097cf94;p=thirdparty%2Fvuejs%2Frouter.git docs: add missing isReady breaking change --- diff --git a/docs/guide/migration/index.md b/docs/guide/migration/index.md index 934fda3b..66447201 100644 --- a/docs/guide/migration/index.md +++ b/docs/guide/migration/index.md @@ -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.