Jump to content

Multiple output CEF to js client


Recommended Posts

Posted

Hey guys,

I tried to trigger an event from CEF to client-side Javascript. It worked, but the event triggers 4x rather than just 1x.
At the CEF apparently, not, because that triggers only 1x, I have tested.
Nevertheless, 4 chatbox outputs arrive when I execute the following code...
Does anyone have any idea what this could be?

HTML & JS CEF

<head>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
	<link rel="stylesheet" href="style.css">
</head>

<body>
	<div class="all">
		<div class="Testdiv" id="TestDiv1"></div>
      	<script>
          document.getElementById("TestDiv1").addEventListener('click', function (event) {
            mp.trigger('testEvent1', event);
            var elem = document.getElementById("TestDiv1");
            elem.parentNode.removeChild(elem);
          });
     	</script>
	</div>
</body>

Clientside Script

mp.events.add('testEvent1', (testArg1) => {
	mp.gui.chat.push("Testtext: " + testArg1);
});

I also tried an alternative spelling in the script part of the HTML / Javascript code

$('#Testdiv').click(() => {
  mp.trigger('testEvent1', "Blabla");
});

 

 

Posted

I have solved the problem:

There seemed to be a conflict of resources and a problem with already deleted files that were still local to my PC.
The solution to the problem was to empty client files and move all other resources out first

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...