You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 line
1.4KB

  1. const cpp_code = `
  2. #include <cheerp/client.h>
  3. #include <cheerp/clientlib.h>
  4. // We need to extend the client namespace to declare our
  5. // custom JavaScript function
  6. namespace client
  7. {
  8. // The name should be the same as the JavaScript one
  9. // The parameters needs to be a const client::String reference
  10. // so that implicit conversion from const char* is supported
  11. void changeTitle(const String& str);
  12. }
  13. using namespace client;
  14. void webMain()
  15. {
  16. Element* titleElement=document.getElementById("pagetitle");
  17. String* oldText=titleElement->get_textContent();
  18. changeTitle("Literal C++ string");
  19. }`.trim();
  20. const html_code = `
  21. <!DOCTYPE html>
  22. <html lang="en">
  23. <head>
  24. <meta charset="utf-8">
  25. <title>Cheerp test</title>
  26. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"><\/script>
  27. <script>
  28. // Use jQuery to make a (trivial) change to the page
  29. function changeTitle(str)
  30. {
  31. $("#pagetitle").text(str);
  32. }
  33. <\/script>
  34. </head>
  35. <body>
  36. <h1 id="pagetitle">Boring static text</h1>
  37. </body>
  38. </html>`.trim();
  39. const js_code = ``.trim();
  40. const flags = `
  41. -cheerp-pretty-code
  42. -cheerp-no-type-optimizer
  43. -cheerp-no-native-math
  44. -cheerp-no-math-imul
  45. -cheerp-no-math-fround
  46. -O3
  47. -target cheerp`.trim()
  48. const wasm_code = '';
  49. export const dom_example = { cpp: cpp_code, js: js_code, wasm: wasm_code, html: html_code, flags: flags }