Some questions about WebSoctet V4
Lizirui opened this issue · comments
I encountered a problem while checking the API. I am using V4, but I want to use some methods that were earlier but not available in V4, such as editor.close() and editor.reset(). . Or how do I manually close WebSoctet using V4? If I can't manually close it, how can myscript instance get back to normal without reloading the page when myscript in the page behaves abnormally. Thank you
Hello,
Let me know if I understood your need. When there is an error in the recognition, the server closes the websocket, and the editor is not usable anymore. What you want is a way to re-start the editor without reloading the whole page.
If so, the solution would be indeed to call a "close" method on the editor, then destroy the editor's DOM element, recreate it and then register it again (using MyScript.register).
Such a "close" method will be available in an upcoming version of MyScriptJS that should be shipped shortly.
Please let me know if this answers your question.
Best Regards,
Benoît
In other words, there is no ‘clone’ method in V4 now? Because I didn't find it in ‘proto’ in ‘editor’
Yes indeed there is no "close" method in MyScriptJS for now.
@Lizirui can you describe exactly what kind of problem you encounter that would make you reload the editor ? We believe that in normal conditions of use one shouldn't have to do this. Maybe we can help.
I am working on a vue-based SPA project. My entry is "/", and I will request some global data to be saved to vuex at the portal, so the page with myscriptjs cannot be refreshed. Re-refresh the page on the "/user/myscript" page, returning to '/user' will cause the program to be abnormal because of some data, so I hope to have a function that allows myscriptjs to reset, to make some errors. Processing makes the program more robust.
@benfonty
In normal conditions (that is, except during development, and if the API is correctly used) you shouldn't have any error.
Maybe you will find useful, if you didn't already see it, our VueJs integration example.
@Lizirui
In other words, there is no ‘close’ method in V4 now? Because I didn't find it in ‘proto’ in ‘editor’