Comments (3)
Hello Gabriel! I'm a bit reluctant about exposing the whole Msg
subtypes because then any internal change in the Msg
implementation would imply a major version bump when publishing the package as explained here: https://medium.com/@ghivert/designing-api-in-elm-opaque-types-ce9d5f113033.
Maybe I can expose some helper functions like isTransitioning : Toasty.Msg -> Bool
to let you extract the internal message.
Would that help with what you are trying to achieve?
from toasty.
Hi @pablen!, I ended creating those helpers functions, and I think it is ok. I was trying to create my own toast component which was just exactly as yours but without having to pass the config record to each function. Here you can see the code and how I exposed those helper functions.
If you think there is an approach better to achieve the same thing, please let me know it :)
from toasty.
Oh, so I think I misunderstood what you were trying to do here.
In your case I think those helper functions are a bit redundant because you can use the Success
, Warning
and Error
types as constructor functions without the need of defining new helper functions.
You can take a look at the demo code, you'll notice I'm using those types in such a way:
Lines 50 to 61 in e8c0a8f
Also, look a few lines above how I defined a single addToast
helper function to avoid having to pass the config record around every time:
Lines 37 to 39 in e8c0a8f
I think you'll be good to go with this!
from toasty.
Related Issues (7)
- Toasts can close prematurely due to ID collision HOT 5
- Accessibility HOT 3
- Demo does not work on mobile HOT 3
- Ability to conditionally show toasts HOT 3
- Elm 0.19 HOT 4
- Remove toasts HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toasty.