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:
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 {
|
JSContextRef context() const {
|
||||||
return m_context;
|
return m_context;
|
||||||
}
|
}
|
||||||
|
@ -223,6 +228,10 @@ public:
|
||||||
return m_value;
|
return m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSType getType() const {
|
||||||
|
return JSValueGetType(m_context, m_value);
|
||||||
|
}
|
||||||
|
|
||||||
bool isBoolean() const {
|
bool isBoolean() const {
|
||||||
return JSValueIsBoolean(context(), m_value);
|
return JSValueIsBoolean(context(), m_value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue