Anyone know of a way to update a `un/message` mess...
# suitescript
e
Anyone know of a way to update a
un/message
message without creating a new instance?
a
nope always just created a new instance... curious why that isn't an option for you?
d
^^ I think is when there is no duration, to prevent multiple from showing at a time probably not optimal implementation, but have used something like this in the past: can create single instance of
MessageManager
and then update shown message as needed
👍 1
a
i mean you can ensure only one message at time by just doing
oldMessage.hide();
newMessage.show();
which i guess is what your solution does, but I've only ever need a few different messages so never made a generic solution like this
d
true, but yah I think my past usecase was like multiple client script button functions with various messages, so keeping track of the various different Message instances wasn't so practical - so just scoped to singular manager I guess to answer original question, I think does require creating new instances one way or another like you mentioned
e
I'd like to use the same instance to show the status of a running task. The NS message fades, so it's a bit distracting. Not a huge deal for me because I'm not staring at it, but it is what it is
I ended up doing what you're doing @dbarnett, thanks
d
theoretically you could overwrite the hideAlert function that is going on behind the scenes to set fadeOut to 0 or have used https://sweetalert2.github.io/#examples I believe is compatible with NS , probably not worth the effort though 😅
e
Yeah, at this point it's not worth the effort lol
💯 1
f
I did something like this on our script. stored the message obj to a global variable since I figured its all stored in a client.