Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org>
  3.  *
  4.  * This file is part of NetSurf, http://www.netsurf-browser.org/
  5.  *
  6.  * NetSurf is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; version 2 of the License.
  9.  *
  10.  * NetSurf is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17.  */
  18.  
  19. /** \file
  20.  * Interface to javascript engine functions.
  21.  */
  22.  
  23. #ifndef _NETSURF_JAVASCRIPT_JS_H_
  24. #define _NETSURF_JAVASCRIPT_JS_H_
  25.  
  26. typedef struct jscontext jscontext;
  27. typedef struct jsobject jsobject;
  28.  
  29. struct dom_document;
  30. struct dom_node;
  31. struct dom_string;
  32.  
  33. /** Initialise javascript interpreter */
  34. void js_initialise(void);
  35.  
  36. /** finalise javascript interpreter */
  37. void js_finalise(void);
  38.  
  39. /** Create a new javascript context.
  40.  *
  41.  * There aare usually one context per browser context
  42.  */
  43. jscontext *js_newcontext(void);
  44.  
  45. /** Destroy a previously created context */
  46. void js_destroycontext(jscontext *ctx);
  47.  
  48. /** Create a new javascript compartment
  49.  *
  50.  * This is called once for a page with javascript script tags on
  51.  * it. It constructs a fresh global window object.
  52.  */
  53. jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv);
  54.  
  55. /* execute some javascript in a context */
  56. bool js_exec(jscontext *ctx, const char *txt, size_t txtlen);
  57.  
  58.  
  59. /* fire an event at a dom node */
  60. bool js_fire_event(jscontext *ctx, const char *type, struct dom_document *doc, struct dom_node *target);
  61.  
  62. bool
  63. js_dom_event_add_listener(jscontext *ctx,
  64.                           struct dom_document *document,
  65.                           struct dom_node *node,
  66.                           struct dom_string *event_type_dom,
  67.                           void *js_funcval);
  68.  
  69.  
  70. #endif /* _NETSURF_JAVASCRIPT_JS_H_ */
  71.