mercredi 5 août 2015

javascript function callback in C code using Emscripten


The task is to call a javascript function as a callback in order to show a progress of while-loop operation. E.g. JS:

var my_js_fn = function(curstate, maxstate){//int variables
console.log(curstate.toString() + " of " + maxstate.toString());
}

C pseudocode:

int smth_that_calls_my_fn(int i, int max) {
/*
the_magic to call my_js_fn()
*/
}
    int main(){
    //....
        while (i < max){
        smth_that_calls_my_fn(i,max);
        }
    //....
    return 0;
    }

How can I link smth_that_calls_my_fn and my_js_fn ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire