mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-29 15:59:39 +08:00
Add getType/getPrivate to Value
Summary: Adds: - getType so you can switch on type - getPrivate Reviewed By: lexs Differential Revision: D3515510 fbshipit-source-id: d574b04f563ac650bacec3751b50be6345e8439a
This commit is contained in:
committed by
Facebook Github Bot 8
parent
201433f05b
commit
10d41b50c2
@@ -191,6 +191,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename ReturnType>
|
||||
ReturnType* getPrivate() const {
|
||||
return static_cast<ReturnType*>(JSObjectGetPrivate(m_obj));
|
||||
}
|
||||
|
||||
JSContextRef context() const {
|
||||
return m_context;
|
||||
}
|
||||
@@ -223,6 +228,10 @@ public:
|
||||
return m_value;
|
||||
}
|
||||
|
||||
JSType getType() const {
|
||||
return JSValueGetType(m_context, m_value);
|
||||
}
|
||||
|
||||
bool isBoolean() const {
|
||||
return JSValueIsBoolean(context(), m_value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user