module JavaScript.Object.Internal
    ( Object(..)
    , create
--    , allProps
    , listProps
    , getProp
    , unsafeGetProp
    , setProp
    , unsafeSetProp
--    , isInstanceOf
    ) where

import Language.Javascript.JSaddle.Types (JSM, JSVal, Object(..), JSString)
import Language.Javascript.JSaddle.Native.Internal
       (newEmptyObject, propertyNames, getPropertyByName, setPropertyByName)

-- | create an empty object
create :: JSM Object
create :: JSM Object
create = JSM Object
newEmptyObject
{-# INLINE create #-}

--allProps :: Object -> JSM JSArray
--allProps o = js_allProps o
--{-# INLINE allProps #-}

listProps :: Object -> JSM [JSString]
listProps :: Object -> JSM [JSString]
listProps = Object -> JSM [JSString]
propertyNames
{-# INLINE listProps #-}

{- | get a property from an object. If accessing the property results in
     an exception, the exception is converted to a JSException. Since exception
     handling code prevents some optimizations in some JS engines, you may want
     to use unsafeGetProp instead
 -}
getProp :: JSString -> Object -> JSM JSVal
getProp :: JSString -> Object -> JSM JSVal
getProp = JSString -> Object -> JSM JSVal
unsafeGetProp
{-# INLINE getProp #-}

unsafeGetProp :: JSString -> Object -> JSM JSVal
unsafeGetProp :: JSString -> Object -> JSM JSVal
unsafeGetProp = JSString -> Object -> JSM JSVal
getPropertyByName
{-# INLINE unsafeGetProp #-}

setProp :: JSString -> JSVal -> Object -> JSM ()
setProp :: JSString -> JSVal -> Object -> JSM ()
setProp = JSString -> JSVal -> Object -> JSM ()
unsafeSetProp
{-# INLINE setProp #-}

unsafeSetProp :: JSString -> JSVal -> Object -> JSM ()
unsafeSetProp :: JSString -> JSVal -> Object -> JSM ()
unsafeSetProp = JSString -> JSVal -> Object -> JSM ()
setPropertyByName
{-# INLINE unsafeSetProp #-}

--isInstanceOf :: Object -> JSVal -> GHCJSPure Bool
--isInstanceOf o s = js_isInstanceOf o s
--{-# INLINE isInstanceOf #-}