Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dynamic route animation #646

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"license": "Apache-2.0",
"devDependencies": {
"web-component-tester": "^6.5.0",
"web-component-tester": "^6.5.1",
"webcomponentsjs": "^1.2.0",
"iron-component-page": "^3.0.0",
"iron-demo-helpers": "^2.0.0",
Expand Down
15 changes: 13 additions & 2 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,19 @@ export class Router extends Resolver {
}

if (from && to && config) {
const leave = isObject(config) && config.leave || 'leaving';
const enter = isObject(config) && config.enter || 'entering';
let leave = 'leaving';
let enter = 'entering';
if (isFunction(config)) {
config = config(from, to);
}
if (isObject(config)) {
if (config.leave) {
leave = config.leave;
}
if (config.enter) {
enter = config.enter;
}
}
promises.push(animate(from, leave));
promises.push(animate(to, enter));
}
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5862,6 +5862,11 @@ fsevents@~2.3.2:
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

fsevents@~2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
Expand Down