Convert to ES6 compatible library#65
Merged
apvarun merged 10 commits intoapvarun:masterfrom Mar 25, 2021
Merged
Conversation
f03ba02 to
403c87d
Compare
Contributor
Author
|
@apvarun I think this is ready for review |
Contributor
Author
|
@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 |
Contributor
Author
|
@apvarun , let me know if there's something I can do to help this get merged in faster |
apvarun
approved these changes
Mar 24, 2021
Owner
apvarun
left a comment
There was a problem hiding this comment.
Code changes looks fine to me.
Owner
|
I think we should also reference this new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
positionLeftwas finally removeddocument.body)Notable changes to code:
(function(){...}).bind(this))letinstead ofvarclassListfunctionality on elementsrootElementis 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)escapeMarkupto allow optionally unsafeinnerHTMLstyleproperty to directly style the toast (this further extendsbackgroundColorfunctionality, and thereforebackgroundColorshould be deprecated in the future in favor of usingstyle.background). Note, since previous functionality tookbackgroundColorand applied it to the elementsbackgroundstyle (which changes all background styles), to prevent breaking changes,backgroundColortakes precedence overstyle.backgroundColor.Things that should still happen:
textinto theinnerHTMLof the toast (probably just want to useinnerText, as there's alreadynodefor when you want to pass in an element)