Idea for 3.0 API
See original GitHub issueHey @caroso1222! Thanks for the project ❤️
I have been thinking about the API and a way to extend the API so it’s easier to add more notification types than just success
and error
.
Seeing that the code that makes the two “types” is nearly identical, it should be pretty “easy” to turn it into a loop:
Instead of using
var notyf = new Notyf({
delay: 1000,
alertIcon: 'fa fa-exclamation-circle',
confirmIcon: 'fa fa-check-circle'
})
I propose moving to:
const notyf = new Notyf({
types: {
success: {
delay: 1000, // #7
duration: 2000, // #6
icon: 'fa-foo-fi-fu'
},
error: {} // use all defaults
}
});
const errorNotification = notyf.error({
title: 'Something went wrong..',
message: 'We had some trouble while processing your request'
});
errorNotification.close(); // #20
errorNotification.on('close', () => console.log('Notification closed'));
notyf.success({
html: "<p>Hooray! <code>image-124.jpg</code> has been uploaded!</p>" // #17
});
By nesting the types
in the types
key, we keep the “root” level open for global options, for example
position
: bottom left|bottom right
or classPrefix
: noty__
.
By using an object instead of a string for the individual
This API change should take care of #6, #7, (half) #13, #17, and #20. Oh, and #21 of course 😉
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
OpenAPI | IntelliJ IDEA Documentation - JetBrains
IntelliJ IDEA provides coding assistance for OpenAPI definitions in YAML and JSON files, and integration with Swagger Codegen for generating ...
Read more >OpenAPI 3.0: From Idea to Implementation - YouTube
In this week's episode, "OpenAPI 3.0 : From Idea to Implementation", Senior Developer Advocate, Ian Douglas has invited API Governance Lead, ...
Read more >Idea - Import REST API's with Swagger 3.0 - OutSystems
I would like to be able to consume REST API's with Swagger/OpenAPI version3 definitions. It would also be nice to be able to...
Read more >External Services OpenAPI 3.0 support - IdeaExchange
Right now I am trying to find public data sources or APIs I can use to lookup medications and associated indications (I need...
Read more >How to quickly publish Restful APIs in OAS 3.0 using the IRIS ...
The first is by creating a JSON XDATA block named apiPub in the implementation class. This method allows more than one tag and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @rijkvanzanten, this is simply awesome, thanks a lot! I really appreciate all the love given to Notyf. It’s impressive that this single issue is taking care of a lot of issues, I love it.
I like the API, let’s roll it in 3.0.0. I’ll also take into consideration the input from @honzabilek4 as having default configs is critical for the success of the project.
Thanks both for this, made my day. I’ll work on this right away and keep you posted here.
Hey everyone. I finally released v3.0.0 and this issue was the cornerstone of this major release. Thanks everyone for the great ideas and suggestions on this thread. I’ve mentioned you all guys in the credits for 3.0.0.
There are still some things in the roadmap like the ability to programmatically close the toasts, but I’ll release that in 3.1.0 for sure.
Thanks again, you’re the best.