-
-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert to ES6 compatible library #65
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @AStoker
This is a nice first step. We can later convert this to TS and also generate types file 👍
f03ba02
to
403c87d
Compare
@apvarun I think this is ready for review |
@apvarun, see anything I missed in this PR? Would love to get this first draft in. Next steps can be to create a Typescript version which can compile out to native modules or legacy javascript |
@apvarun , let me know if there's something I can do to help this get merged in faster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes looks fine to me.
I think we should also reference this new |
ES6 Conversion + Features
Resolves #15
Added a new file (
toastify-es.js
) which contains an ES6 compliant version of Toastify.Few improvements and changes to behavior:
positionLeft
was finally removeddocument.body
)Notable changes to code:
(function(){...}).bind(this)
)let
instead ofvar
classList
functionality on elementsrootElement
is now stored on the class so when we remove toasts we know where to look specifically (this enhanced the ability of putting toasts inside elements and allows you to use Toastify inside shadowDom nodes)escapeMarkup
to allow optionally unsafeinnerHTML
style
property to directly style the toast (this further extendsbackgroundColor
functionality, and thereforebackgroundColor
should be deprecated in the future in favor of usingstyle.background
). Note, since previous functionality tookbackgroundColor
and applied it to the elementsbackground
style (which changes all background styles), to prevent breaking changes,backgroundColor
takes precedence overstyle.backgroundColor
.Things that should still happen:
text
into theinnerHTML
of the toast (probably just want to useinnerText
, as there's alreadynode
for when you want to pass in an element)