internal static Type _GetTypeFromInstance(JsObject instance)
{
var typeFunction = instance["$type"].As<JsTypeFunction>();
if (typeFunction == null)
{
var typeString = Jsni._typeof(instance);
if (typeString == "string".As<JsString>())
{
return typeof(string);
}
if (typeString == "number".As<JsString>())
{
return typeof(Number);
}
if (typeString == "object".As<JsString>())
{
return typeof(object);
}
if (typeString == "function".As<JsString>())
{
return typeof(Delegate);
}
else
{
throw new Exception();
}
}
else
{
return _GetTypeFromTypeFunc(typeFunction);
}
}