New issue
 Projects > js > Issues > Refactor #5683

Study new solution for overriding C++ invoked functions in JS

Refactor #5683 [New]
pandamicro 2014-07-08 06:49

There are some functions in engine which is always invoked by C++

- onEnter
- onExit
- update of Actions

So if we inherit a class from engine class, and want to rewrite these functions, we need to call the js functions directly in C++, there is an solution for onEnter/onExit today, but it is very confusing and need to modify all classes which have onEnter function.

Take onEnter as example
Maybe it's better to add a fake onEnter function to detect whether there is a js overrided implementation of onEnter, if yes, invoke the extended onEnter function, otherwise call C++ original _onEnter function. This means the original onEnter function will be renamed to _onEnter and delegate to the fake onEnter

Atom PDF

Start date:2014-07-08
Due date:
% Done:


Target version:Unplanned