Jump to content

setBrowserRenderingPaused


Skream

Recommended Posts

  • Moderators
Posted (edited)

setBrowserRenderingPaused = probably stopping the browser with making cycles.

Probably stop doing this:

1*DvtGakCxv1pYZzwiaPN4kg.png

 

 

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 by IIYAMA

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
41 minutes ago, IIYAMA said:

setBrowserRenderingPaused = probably stopping the browser with making cycles.

Probably stop doing this:

1*DvtGakCxv1pYZzwiaPN4kg.png

 

 

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
Posted

use JS

executeBrowserJavascript ( webBrowser, 'document.getElementById("element-id").innerHTML = ""')

 

https://wiki.multitheftauto.com/wiki/ExecuteBrowserJavascript

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
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
Posted (edited)

Yes you need to add it again.

Better to clear the innerHTML in text-chat instead.

Edited by IIYAMA

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...