I'm just trying to understand nan/node native extensions.
First question, class hierachy when wrapping C++ stuff.
Is unwrapping a static cast? (So far I guess so ) or can it in fact be a dynamic cast?
Say I got in C++ Wrapper AClass and Wrapper BClass that both inherit from Wrapper MasterClass.
Can I put in
MasterClass *mc = Nan::ObjectWrap::Unwrap<MasterClass>( info[ 0 ]->ToObject( ) );
}
and have it work when javascript hands a Wrapper for AClass or BClass?
If not, how can I determine which type of wrapped object javascript handed to myFunc?
Second question:
How can I throw an javascript Exception from native if its simple sync code without I/O. Usually should do when the arguments are not what they need to be.
Kind regards, Axel