Code Monkey home page Code Monkey logo

Comments (10)

wavded avatar wavded commented on July 18, 2024

I don't think this is a good idea and here is why. Setting up options per notification type (rather than per notification) provides you the developer with a notification "framework" that keeps your messages to users consistent (logging frameworks do this). You have done the leg work of defining three types of notifications which is good, my recommendation is to configure those three types using the four provided in humane.

e.g.

humane.log.timeout = 1000;
humane.info.timeout = 3000;
humane.error.timeout = 0;

Now you've classified your logging system for your site. I could see making 'custom' types perhaps in the future, but do sites really need more than four classifications for notifications? I don't know, I usually use one :)

Marc

from humane-js.

alanhogan avatar alanhogan commented on July 18, 2024

I must disagree.

The current situation does not quite satisfy my motivating examples and current needs.

Also, a logging system is only superficially similar to a notification system. A notification framework forms part of the UI and as such must be as flexible and extensible as is required to meet user experience requirements. (Usually no such analog exists for app logging.) Furthermore, app logging is very "historical", decoupled, searchable, etc.; notifications are none of these and are only useful in the present.

On Jan 25, 2012, at 7:47 PM, Marc [email protected] wrote:

I don't think this is a good idea and here is why. Setting up options per notification type (rather than per notification) provides you the developer with a notification "framework" that keeps your messages to users consistent (logging frameworks do this). You have done the leg work of defining three types of notifications which is good, my recommendation is to configure those three types using the four provided in humane.

e.g.

humane.log.timeout = 1000;
humane.info.timeout = 3000;
humane.error.timeout = 0;

Now you've classified your logging system for your site. I could see making 'custom' types perhaps in the future, but do sites really need more than four classifications for notifications? I don't know, I usually use one :)

Marc


Reply to this email directly or view it on GitHub:
#19 (comment)

from humane-js.

wavded avatar wavded commented on July 18, 2024

You listed three types above, I showed you a configuration for those three types, help me understand why does this not work for you?

from humane-js.

alanhogan avatar alanhogan commented on July 18, 2024

The first bullet point was an info message (type "info") that I would want to show for shorter than most other "type info" messages.

The second two bullets were both "error" type messages.

from humane-js.

alanhogan avatar alanhogan commented on July 18, 2024

Consider the alternative, currently, given my needs:

Setting options for the type about to be used, immediately before using it – every time! It feels (and is!) very, very dirty.

from humane-js.

wavded avatar wavded commented on July 18, 2024

I agree that is dirty nor will it really do what you want because it will override others in the queue of the same type when its time for them to shine. The API isn't very good for your use case. I'll think about it. Right now I could see doing:

var mycustomnotify = humane.create( { type: 'info', timeout: 1000, clickToClose: true } );
mycustomnotify('hello world')

from humane-js.

alanhogan avatar alanhogan commented on July 18, 2024

That would make more sense, yeah.

A few days ago, I modified the API to better suit my needs, where the second parameter is no longer a function, but an options hash (including a callback, still), capable of setting clickToClose, timeout, and an id (for use in remove, as I mentioned elsewhere). I haven’t had much time to test it, yet. Would you be interested in playing with it?

from humane-js.

wavded avatar wavded commented on July 18, 2024

I'll take a peak, is it in a fork?

from humane-js.

alanhogan avatar alanhogan commented on July 18, 2024

It’s not a fork and I likely won’t create a public fork, but I made this gist if you’re interested.

https://gist.github.com/1735493

Again, I haven’t had the opportunity to really test the changes yet or anything.

from humane-js.

wavded avatar wavded commented on July 18, 2024

ok @alanhogan, I put this in per the api outlined above, feel free to play around;

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