jsbindings/jsbindings.cpp
static JSValueRef AAMP_setSubscribeTags(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception)
{
	LOG("[AAMP_JS] %s()", __FUNCTION__);
	AAMP_JS* pAAMP = (AAMP_JS*)JSObjectGetPrivate(thisObject); 
	if(!pAAMP)
	{
		ERROR("[AAMP_JS] %s() Error: JSObjectGetPrivate returned NULL!", __FUNCTION__);
		*exception = aamp_GetException(context, AAMPJS_MISSING_OBJECT, "Can only call AAMP.subscribedTags on instances of AAMP");
		return JSValueMakeUndefined(context);
	}

	if (argumentCount != 1)
	{
		ERROR("[AAMP_JS] %s() InvalidArgument: argumentCount=%d, expected: 1", __FUNCTION__, argumentCount);
		*exception = aamp_GetException(context, AAMPJS_INVALID_ARGUMENT, "Failed to execute 'AAMP.setSubscribeTags' - 1 argument required");
	}
	else if (!aamp_JSValueIsArray(context, arguments[0]))
	{
		ERROR("[AAMP_JS] %s() InvalidArgument: aamp_JSValueIsArray=%d", __FUNCTION__, aamp_JSValueIsArray(context, arguments[0]));
		*exception = aamp_GetException(context, AAMPJS_INVALID_ARGUMENT, "Failed to execute 'AAMP.setSubscribeTags' - parameter 1 is not an array");
	}
	else
	{
		if(pAAMP->_subscribedTags)
		{
			JSValueUnprotect(pAAMP->_ctx, pAAMP->_subscribedTags);
		}
		pAAMP->_subscribedTags = JSValueToObject(context, arguments[0], NULL);
		if(pAAMP->_subscribedTags)
		{
			JSValueProtect(pAAMP->_ctx, pAAMP->_subscribedTags);
			std::vector<std::string> subscribedTags = aamp_StringArrayToCStringArray(context, arguments[0]);
			pAAMP->_aamp->SetSubscribedTags(subscribedTags);
		}
	}
	return JSValueMakeUndefined(context);
}
/**
 * @brief Callback invoked from JS to set list of subscribed tags
 *
 * @param[in] context       JS execution context
 * @param[in] function      JSObject that is the function being called
 * @param[in] thisObject    JSObject that is the 'this' variable in the function's scope
 * @param[in] argumentCount number of args
 * @param[in] arguments[]   JSValue array of args
 * @param[out] exception    Pointer to a JSValueRef in which to return an exception, if any
 *
 * @retval JSValue that is the function's return value
 */


@retval JSValue that is the function's return value
@retval JSValue that is the function ' s return value
static JSValueRef AAMP_setSubscribeTags(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception)
{
	LOG("[AAMP_JS] %s()", __FUNCTION__);
	AAMP_JS* pAAMP = (AAMP_JS*)JSObjectGetPrivate(thisObject); 
	if(!pAAMP)
	{
		ERROR("[AAMP_JS] %s() Error: JSObjectGetPrivate returned NULL!", __FUNCTION__);
		*exception = aamp_GetException(context, AAMPJS_MISSING_OBJECT, "Can only call AAMP.subscribedTags on instances of AAMP");
		return JSValueMakeUndefined(context);
	}
	if (argumentCount != 1)
	{
		ERROR("[AAMP_JS] %s() InvalidArgument: argumentCount=%d, expected: 1", __FUNCTION__, argumentCount);
		*exception = aamp_GetException(context, AAMPJS_INVALID_ARGUMENT, "Failed to execute 'AAMP.setSubscribeTags' - 1 argument required");
	}
	else if (!aamp_JSValueIsArray(context, arguments[0]))
	{
		ERROR("[AAMP_JS] %s() InvalidArgument: aamp_JSValueIsArray=%d", __FUNCTION__, aamp_JSValueIsArray(context, arguments[0]));
		*exception = aamp_GetException(context, AAMPJS_INVALID_ARGUMENT, "Failed to execute 'AAMP.setSubscribeTags' - parameter 1 is not an array");
	}
	else
	{
		if(pAAMP->_subscribedTags)
		{
			JSValueUnprotect(pAAMP->_ctx, pAAMP->_subscribedTags);
		}
		pAAMP->_subscribedTags = JSValueToObject(context, arguments[0], NULL);
		if(pAAMP->_subscribedTags)
		{
			JSValueProtect(pAAMP->_ctx, pAAMP->_subscribedTags);
			std::vector<std::string> subscribedTags = aamp_StringArrayToCStringArray(context, arguments[0]);
			pAAMP->_aamp->SetSubscribedTags(subscribedTags);
		}
	}
	return JSValueMakeUndefined(context);
}
static JSValueRef AAMP_setSubscribeTags ( JSContextRef context , JSObjectRef function , JSObjectRef thisObject , size_t argumentCount , const JSValueRef arguments [ ] , JSValueRef * exception ) { LOG ( " " , __FUNCTION__ ) ; AAMP_JS * pAAMP = ( AAMP_JS * ) JSObjectGetPrivate ( thisObject ) ; if ( ! pAAMP ) { ERROR ( " " , __FUNCTION__ ) ; * exception = aamp_GetException ( context , AAMPJS_MISSING_OBJECT , " " ) ; return JSValueMakeUndefined ( context ) ; } if ( argumentCount != 1 ) { ERROR ( " " , __FUNCTION__ , argumentCount ) ; * exception = aamp_GetException ( context , AAMPJS_INVALID_ARGUMENT , " " ) ; } else if ( ! aamp_JSValueIsArray ( context , arguments [ 0 ] ) ) { ERROR ( " " , __FUNCTION__ , aamp_JSValueIsArray ( context , arguments [ 0 ] ) ) ; * exception = aamp_GetException ( context , AAMPJS_INVALID_ARGUMENT , " " ) ; } else { if ( pAAMP -> _subscribedTags ) { JSValueUnprotect ( pAAMP -> _ctx , pAAMP -> _subscribedTags ) ; } pAAMP -> _subscribedTags = JSValueToObject ( context , arguments [ 0 ] , NULL ) ; if ( pAAMP -> _subscribedTags ) { JSValueProtect ( pAAMP -> _ctx , pAAMP -> _subscribedTags ) ; std :: vector < std :: string > subscribedTags = aamp_StringArrayToCStringArray ( context , arguments [ 0 ] ) ; pAAMP -> _aamp -> SetSubscribedTags ( subscribedTags ) ; } } return JSValueMakeUndefined ( context ) ; }
@brief Callback invoked from JS to set list of subscribed tags
 @param[in] context       JS execution context
 @param[in] function      JSObject that is the function being called
 @param[in] thisObject    JSObject that is the 'this' variable in the function's scope
 @param[in] argumentCount number of args
 @param[in] arguments[]   JSValue array of args
 @param[out] exception    Pointer to a JSValueRef in which to return an exception, if any
@brief Callback invoked from JS to set list of subscribed tags @param [ in ] context JS execution context @param [ in ] function JSObject that is the function being called @param [ in ] thisObject JSObject that is the ' this ' variable in the function ' s scope @param [ in ] argumentCount number of args @param [ in ] arguments [] JSValue array of args @param [ out ] exception Pointer to a JSValueRef in which to return an exception if any