-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
Description
Description
I am implementing an AI dialogue function, strings,i need to dynamically change the value of strings,since my data is being streamed, it may need to change while typing.
After 2 days of trying,I found that it seems that such a function cannot be achieved.
const typed = new Typed(dialogueContentRef.current, {
strings: dialogueContentRef.current.strings,
typeSpeed: 50,
showCursor: false,
});
dialogueContentRef.current.typed = typed;
when i try to change strings value
dialogueContentRef.current.strings.push(messageValue) // it can't work
dialogueContentRef.current.strings = ['test'] // it can work
Now, not providing a way to continue typing, I have to reset, like this
dialogueContentRef.current..reset()
The problem with this is that all the text is printed from scratch, which doesn't satisfy my expectations.
I hope that when I receive new text, I can continue to print
like this
this demo shows print 'test1', after xxx s, print 'test2'
print('test1');
settimeOut(xxx);
print('test2');
settimeOut(xxx);
print('test3');
.
.
.
Do you have any good suggestions, because currently it seems that strings cannot be accepted with a state
jaluik, livingemoji, BoBoooooo, GreatHacker and jm-nab