FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
void FB::JSAPISimple::registerProperty ( const std::string &  name,
GetPropPtr  getFunc,
SetPropPtr  setFunc 
)
virtual

Register a property to be exposed to javascript.

All properties exposed to javascript through JSAPISimple must use getter functions that match the FB::GetPropPtr type and setter functions that match the FB::SetPropPtr type.

// read-only
registerProperty( "valid", (GetPropPtr)&MySimpleAPI::getValid, NULL );
// -or- write-only
registerProperty( "valid", NULL, (SetPropPtr)&MySimpleAPI::setValid );
// -or- read-write
registerProperty( "valid", (GetPropPtr)&MySimpleAPI::getValid, (SetPropPtr)&MySimpleAPI::setValid);
@code
This matches the following definition:
@code
variant getValid();
void setValid(variant value);
Parameters
nameThe name.
getFuncThe get function (or NULL for write-only)
setFuncThe set function (or NULL for read-only)

Definition at line 85 of file JSAPISimple.cpp.

86 {
87  m_propertyMap[name].getFunc = getFunc;
88  m_propertyMap[name].setFunc = setFunc;
89 }