Skream Posted April 6, 2018 Posted April 6, 2018 (edited) setBrowserRenderingPaused hidde the browser? How can I destroy the browser? Edited April 6, 2018 by Skream
Moderators IIYAMA Posted April 6, 2018 Moderators Posted April 6, 2018 (edited) setBrowserRenderingPaused = probably stopping the browser with making cycles. Probably stop doing this: You will need to use guiSetVisible to hide the gui: https://wiki.multitheftauto.com/wiki/GuiSetVisible Yet I recommend you to doing both, because afaik the browser doesn't stops rendering when you hide the gui. (will save you some performance) Edited April 6, 2018 by IIYAMA 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Skream Posted April 6, 2018 Author Posted April 6, 2018 41 minutes ago, IIYAMA said: setBrowserRenderingPaused = probably stopping the browser with making cycles. Probably stop doing this: You will need to use guiSetVisible to hide the gui: https://wiki.multitheftauto.com/wiki/GuiSetVisible Yet I recommend you to doing both, because afaik the browser doesn't stops rendering when you hide the gui. (will save you some performance) I'm doing a CEF chat But I need a clearChat function to anti divulgation propouses do you think this would do the job ? function clearChatBox() loadBrowserURL(cefBrowser, chatUrl) end like a attempt to "reload" the url?
Moderators IIYAMA Posted April 6, 2018 Moderators Posted April 6, 2018 use JS executeBrowserJavascript ( webBrowser, 'document.getElementById("element-id").innerHTML = ""') https://wiki.multitheftauto.com/wiki/ExecuteBrowserJavascript 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Skream Posted April 6, 2018 Author Posted April 6, 2018 8 minutes ago, IIYAMA said: use JS executeBrowserJavascript ( webBrowser, 'document.getElementById("element-id").innerHTML = ""') https://wiki.multitheftauto.com/wiki/ExecuteBrowserJavascript I think its not that simple because I use insertAdjacentHTML too much. What about function clearChat() { var resetHtml = "<div class='container'>" + "<div id='text-chat' class='chat'></div>" + "<input id='chat-input' type='text' placeholder='Fale por aqui...' spellcheck='false'>" "</div>"; document.body.innerHTML = resetHtml; } do you have any ideia if I would need to call addEventListener again? Because I use focusout check onload window.onload = function() { const chatInput = document.getElementById('chat-input'); chatInput.addEventListener('focusout', function(e) { chatInput.style.animation = 'hide .2s'; chatInput.style.animationFillMode = 'forwards'; mta.triggerEvent('processChat', ''); document.removeEventListener('keydown', enterKeyInputBox, false); }); };
Moderators IIYAMA Posted April 6, 2018 Moderators Posted April 6, 2018 (edited) Yes you need to add it again. Better to clear the innerHTML in text-chat instead. Edited April 6, 2018 by IIYAMA 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now