This is my attempt to emulate querySelector, in order to use it to set more 
click events.
I have take a look inside* library_html.js* and i found 
*emscripten_set_click_callback*:,
but something went wrong ... as can you see in error below :

#include <emscripten.h>
#include <emscripten/html5.h>
#include <stdio.h>
 
/*
EM_BOOL key_callback(int eventType, const EmscriptenKeyboardEvent *e, void 
*userData)
{
  printf("You pressed key %lu\n", e->which);
  return 1;
}
*/
EM_BOOL click_callback(int eventType, const EmscriptenMouseEvent *e, void *
userData)
{
  printf("You just clicked\n");
  return 1;
}

// ..................................................... query selector

char* querySelector( const char *q,const char *userData,const char *
userCapture,const char *callbackfunc ) 
{
        char *element ;
        
        element  = (char*)EM_ASM_INT(
        {
                var q                           = Pointer_stringify ( $0 ) ;
                var userData            = Pointer_stringify ( $1 ) ;
                var useCapture          = Pointer_stringify ( $2 ) ;       
     
                var callbackfunc        = Pointer_stringify ( $3 ) ;
                
                var ids = $(q).map(function() { return this.id; }).toArray
();
                
                console.log ( "array querySelector id" ) ;              
                console.log ( ids ) ;   

                console.log ( Module ) ;
                return -1 ;
                
                for (i=0;i<ids.length;ids++)
                {




*                        ???                                               
  emscripten_set_click_callback( ids[i] ,  userData, userCapture, 
callbackfunc );                                                ???*
                }
                        
                return 0 ;
        },q,userData,userCapture,callbackfunc ) ;
        
        return element ;
}



int main()
{

  querySelector ( ".x","0","1","click_callback" ) ;
  
  return 0;
}


any help ?


-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to