https://github.com/kripken/emscripten
Raw File
Tip revision: 91238326d42b5e40c4bed76c3ccee756cff72235 authored by Alon Zakai on 07 December 2016, 01:19:02 UTC
make it easier to add basic_vars in emscripten.py, allow a different name for the outside var and the inside one
Tip revision: 9123832
doublestart.c
#include <stdio.h>
#include <emscripten.h>

int times = 0;

void later(void* nada) {
  int result = times;
  REPORT_RESULT();
}

void main_loop(void) {
  static int cnt = 0;
  if (++cnt >= 10) emscripten_cancel_main_loop();
}

int main(void) {
  emscripten_async_call(later, NULL, 2000);
  times++;
  printf("This should only appear once.\n");
  emscripten_set_main_loop(main_loop, 10, 0);
  return 0;
}

back to top