Add associated constants for common JS values

This commit is contained in:
Nick Fitzgerald 2018-06-08 14:22:18 -07:00
parent e639a3f08f
commit e4dcb8f85e

View File

@ -67,6 +67,18 @@ const JSIDX_FALSE: u32 = 6;
const JSIDX_RESERVED: u32 = 8;
impl JsValue {
/// The `null` JS value constant.
pub const NULL: JsValue = JsValue { idx: JSIDX_NULL };
/// The `undefined` JS value constant.
pub const UNDEFINED: JsValue = JsValue { idx: JSIDX_UNDEFINED };
/// The `true` JS value constant.
pub const TRUE: JsValue = JsValue { idx: JSIDX_TRUE };
/// The `false` JS value constant.
pub const FALSE: JsValue = JsValue { idx: JSIDX_FALSE };
/// Creates a new JS value which is a string.
///
/// The utf-8 string provided is copied to the JS heap and the string will