You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Proxy to instance methods to constructor, for now, for backwards compatibility
Object.keys(instanceMethods).forEach(key=>{
SweetAlert[key]=function(...args){
if(currentInstance){
returncurrentInstance[key](...args)
}
}
})
We should
drop this block of code
change the appropriate static methods to instance methods (e.g. Swal.getTitle() -> swal.getTitle()). Should make sure that calling these methods apply to that particular instance, and not the currently active swal, since they can be different. (Note: there are no instance methods that should become static methods)
add static method like Swal.getCurrentInstance(), which will be generally useful, and also allow for easy migration in situations where a user is using one of the methods that were changed to an instance method, but they didn't save a reference to the instance
This looks like a feature request. In future please follow the templates when you reporting/requesting something to be done.
This request is missing the "New feature motivation" section. Please describe the context, the use-case and the advantages of the feature request. What will change for end-users and why do they need this feature?
Right now, for backwards compatibility, all instance methods are also exposed as static methods, via proxy methods defined here:
sweetalert2/src/SweetAlert.js
Lines 59 to 66 in 5efb897
We should
Swal.getTitle()
->swal.getTitle()
). Should make sure that calling these methods apply to that particular instance, and not the currently active swal, since they can be different. (Note: there are no instance methods that should become static methods)Swal.getCurrentInstance()
, which will be generally useful, and also allow for easy migration in situations where a user is using one of the methods that were changed to an instance method, but they didn't save a reference to the instanceThe text was updated successfully, but these errors were encountered: