Sallynger

How to call a function from another js file

Recommended Posts

Hi. I call a function in main.js from login.js. But it gives me such an error. I call the function like this 

mp.events.add('RegResultFalse', () => {
	mp.events.call('executeFunction', ['emailStatus']);
})

the function in login.js is described as:

function emailStatus() {
    $("#emailStatus").removeClass("hide");
}

Tell me what am I doing wrong? Thank you in advance. In parallel with this, I read the wiki, if I find the answer, I will write

Edited by Sallynger

Share this post


Link to post
Share on other sites

If u want to call CEF function from client-side you need to write browser.execute(`someFunc(${args})`);
If u want to call client-side from CEF you need to write mp.trigger('functionName', args0, args2);

Share this post


Link to post
Share on other sites

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.