0

is there an example in which a message from c++ sent like dom->sendMessage("something") , is used inside a javascript?

thank you, daniele

D.Giunchi
  • 1,900
  • 3
  • 19
  • 23

1 Answers1

1

The html-overlay example is what you're looking for. Here is a more detailed answer about how to get those messages in JavaScript.

Note that the Minko AbstractDOMElement implementation "should" give you all the DOM methods you need to interact with any DOM element directly in C++ without JS. Including (but not limited to):

Using those methods your C++ code can easily "change" the HTML5 UI components just as you would in pure JS (since it's the same DOM API).

Now if you want some JS code to be "notified", your JS code can:

  • listen to the actual correspoding DOM events;
  • listen to a custom message you'll have to send from the C++ code.
Community
  • 1
  • 1
  • mmm I don't get one thing. Suppose I've js code, very simple like, creation of an object. I want to send a message to the dom from c++ for change an attribute of it. I supposed that I can add a listener for example an wait for the event, and handle all at js level; is it right? – D.Giunchi Mar 23 '15 at 12:40
  • I've modified my answer to explain how the Minko DOM abstraction allow you do to DOM manipulation directly from C++. – Jean-Marc Le Roux Mar 23 '15 at 13:11
  • I tried to modify overlay example just to apply the sendMessage from c++ to js, http://pastebin.com/3yPDvAvE , but it doen's work... where am I wrong? – D.Giunchi Mar 23 '15 at 14:08