Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6697067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:24:58+00:00 2026-05-26T06:24:58+00:00

So I was messing around with google’s hangouts api and there is a function

  • 0

So I was messing around with google’s hangouts api and there is a function called addStateChangeListener(
callback
)
which allows you to register a callback function that will be called whenever the state of the application changes.

An example callback function that could be registered is

function onStateChanged(add, remove, state, metadata) {
  state_ = state;
  metadata_ = metadata;

  if (<some boolean>) {
    doFunction(); //this function alters the state
  }

  //more stuff below
}

My question is: If doFunction() did something that altered the state, (and triggered the addStateChangeListener) would onStateChange be called again before the rest of function after the if statement ran?
Or would the first iteration of onStateChange() run to its completion first and then onStateChange would get called again.
Or would it possibly just completely ignore the rest of the first onStateChange function, and just recall onStateChange when doFunction changes the state?

Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:24:58+00:00Added an answer on May 26, 2026 at 6:24 am

    Looking at the Google Hangouts API reference, it would appear that it would run the callback function again if you changed the state. Specifically:

    the callback will be called for changes in the shared state which
    result from submitDelta calls made from the local participant’s app.

    It would definitely not ignore the rest of the first callback function, and it would probably (although it may not, for example, if it checks with the server via an Ajax call that the state has actually changed) also run the second immediately, without waiting for the first callback function to finish. If you wanted to ensure that the first function always completes before the second is called, you could always delay your call to change the state with window.setTimeout() around the call to doFunction(). Specifying a 1 millisecond delay will be enough.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started learning about servers, and I am messing around with Google's App
I'm new to Google Apps and I've been messing around with the hello world
I've started messing around with Google App Engine, writing Python. I love Visual Studio
I'm messing around with Win32 API and windows messaging trying to figure out how
I'm just messing around with the Factual API but I don't fully understand how
I have been messing around with the Google's JavaScript code and I saw in
I've been messing around with jQuery-UI's widget factory to create a google map widget.
Messing around with 'extension functions' for the List module. (I spent quite a while
I am messing around with a toy interpreter in Java and I was considering
I was messing around with RhinoMocks this morning and couldn't run my tests because

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.