Giter Site home page Giter Site logo

ifvisible is not defined about timeme.js HOT 6 CLOSED

henryruhs avatar henryruhs commented on June 27, 2024
ifvisible is not defined

from timeme.js.

Comments (6)

jasonzissman avatar jasonzissman commented on June 27, 2024

Good idea! Do you have any recommendations on what to do if ifvisible is not defined? I could include a console.log() message, but I don't know if people typically want log messages (even during exceptional cases like this) to be written to the console. Perhaps I should throw an exception instead?

from timeme.js.

henryruhs avatar henryruhs commented on June 27, 2024

I suggest to write an internal method getVisible or ifVisible for the external library like:

(function (ifvisible) {
..
..
..
getVisible: function() {
    if (typeof ifvisible === 'object') {
      //return the ifvisible object
    }
    else {
      throw 'error, warning or whatever you think';
    }
}
..
..
})(this.ifvisible);

Later on I suggest to use this internal method / wrapper inside a listen method that is made for the event handling... ifvisible.on(...)

listen: function () {
     ..
    TimeMe.getVisible.on('...')
     ..
}

Finally you let the user start the listen method or add it to your init method.

from timeme.js.

jasonzissman avatar jasonzissman commented on June 27, 2024

I put together a pull request: #11. Care to take a look at it? Thanks as always for the help.

from timeme.js.

henryruhs avatar henryruhs commented on June 27, 2024

Looks good

from timeme.js.

henryruhs avatar henryruhs commented on June 27, 2024

Please create a new tag like 1.1.0

from timeme.js.

jasonzissman avatar jasonzissman commented on June 27, 2024

Done!

from timeme.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.