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

Fix #264 Preact Router is not able to be extended #265

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

studentIvan
Copy link

fix #264

Add setCustomHistory function, because customHistory is read-only when exports.
Router class now extendable, to extend it - simple copy its constructor without "Object.getPrototypeOf" condition.
Add export for canRoute, delegateLinkHandler, routeTo, customHistory, setCustomHistory.

Add setCustomHistory function, because customHistory is read-only when exports.
Router class now extendable, to extend it - simple copy its constructor without "Object.getPrototypeOf" condition.
Add export for canRoute, delegateLinkHandler, routeTo, customHistory, setCustomHistory.
This was referenced Jan 27, 2018
customHistory = props.history;
}
/** this condition allows to modify the constructor */
if (Object.getPrototypeOf(this.constructor).name === 'Component') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks when minified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preact Router is not able to be extended
3 participants