[Solved] How to use Notification addError?


#1

I have an issue using Atom NotificationManager, I don’t know how to use the option object and since the documentation doesn’t give you an example.
I have to create an error Notification with a button that can be expanded/collapsed revelaing the real error message.
Please help!


#2

You describe it like any other object.

atom.notifications.addSuccess("This works.", {
  buttons: [
    {
    className: "btn-details",
    onDidClick: function() {},
    text: "Details"
    }
  ],
  detail: "This is more stuff here."
})

#3

Thanks, It’s finally working!
Anyway I think that atom docs have to improve, maybe with some examples?


#4

The Atom documentation, like Atom itself, is open source. If you have some ideas for examples that you feel would be helpful to others, we’d love to take a look at a Pull Request adding them :grinning:


#5

Where could I do a pull request for the docs?
GitHub?


#6

Yes. If you’re talking about documentation on https://atom.io/docs/api/latest, you would submit a Pull Request to https://github.com/atom/atom. If you’re talking about documentation on http://flight-manual.atom.io, you would submit a Pull Request to https://github.com/atom/flight-manual.atom.io.


#7

Is this part of the Atom Flight Manual?


#8

No. The NotificationManager documentation is part of the API.


#9

Is that editable?
Could I modify it with a pull request or something like that?


#10

Yes, it’s right here. The API documentation is generated from the comments in the code.


#11

Thanks!
I will try to improve the docs