Git Product home page Git Product logo

Comments (6)

fabien-d avatar fabien-d commented on May 29, 2024

This was being discussed in pull request #10. The request was to add a DOM loaded event, which I'm still not sure is the right approach for this project since most people already have a library to do this (e.g. jQuery)...

I was thinking of 2 options (code examples are just for visual purposes):

  • expose the init method in the API meaning it would have to be initiated before use
// initialize after DOM ready
alertify.init();

// use
alertify.alert("...");
  • check the first time alertify is used to see if it's already been initialized. That way it doesn't change the current usage but prevents alertify from trying to create DOM elements before it's told to.
// maybe in the dialog method
if (typeof init === "function") init();

// and have the init method delete itself after first use
init = function () {
    ...
    delete this.init;
}

I'd love to get some input on it.

from alertify.js.

drazion avatar drazion commented on May 29, 2024

Just as an aside, you may want to consider making the body requirement a little more apparent in the docs. Although I was able to figure this out fairly quickly, specifically when I saw n.body is null, it was not immediately clear that alertify.js needs to be in the body. But otherwise implementing it was a breeze.

To your point above, I like that it's not put into the DOM until I need it. On the page where I use it, I'm already relying on the client to parse a good deal of code and determine the layout, so for me at least, this is a great feature.

from alertify.js.

fabien-d avatar fabien-d commented on May 29, 2024

Documentation updates are a priority this weekend - mainly around usage, code contribution guidelines ...

from alertify.js.

lightswitch05 avatar lightswitch05 commented on May 29, 2024

Looking forward to this fix since Ruby On Rails automatically includes javascript in the <head>

from alertify.js.

fabien-d avatar fabien-d commented on May 29, 2024

Fixed with ^ pull request

from alertify.js.

veracarr avatar veracarr commented on May 29, 2024

hi Fabien,

this fixed my problem. thank you!!

vera

from alertify.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.