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

Subclassing? #70

Closed
heston opened this issue Dec 19, 2012 · 1 comment
Closed

Subclassing? #70

heston opened this issue Dec 19, 2012 · 1 comment

Comments

@heston
Copy link

heston commented Dec 19, 2012

First off, I have to say that I really like alertify. It provides a great baseline of functionality and is easy to use. However, during the course of a project, I found myself wanting to add additional functionality to alertify -- such as rendering different HTML in some cases, or adding a "close" button in the upper right. This sort of stuff is definitely outside the scope of alertify's core usage. So, what's a guy to do? Subclass and overload! It would be awesome to simply inherit from alertify, overload the build method, and do whatever I wanted.

Unfortunately, the architecture of alertify does not allow that. Everything inside the constructor is a private method or property (http://javascript.crockford.com/private.html), so it's impossible to access these in inheriting classes. I know it's a big job to refactor alertify into a inheritance-friendly structure, but I thought I'd put it out there all the same.

@fabien-d
Copy link
Owner

Alertify is more aimed at replicating the native dialog which is why the public API is limited and only exposes the absolute required methods. I'm not sure if extending fits the description of what alertify.js tries to achieve.

For custom HTML or close buttons (to reuse your examples) falls more under a modal pattern, which many great libraries already offer.

psolom pushed a commit to psolom/alertify.js that referenced this issue Aug 23, 2016
When user clicks on the element (or its children), alertify should remove the root element.
psolom pushed a commit to psolom/alertify.js that referenced this issue Aug 23, 2016
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

No branches or pull requests

2 participants