jsbindings/jsbindings.cpp
/**
 *   @brief  Removes the AAMP instance from JS context
 *
 *   @param[in]  context - JS execution context
 *
 *   @return void
 */
@brief  Removes the AAMP instance from JS context
@param[in]  context - JS execution context

@return void
@brief Removes the AAMP instance from JS context @param [ in ] context - JS execution context @return void
void aamp_UnloadJS(void* context)
{
	INFO("[AAMP_JS] %s() context=%p", __FUNCTION__, context);
	JSGlobalContextRef jsContext = (JSGlobalContextRef)context;
	JSObjectRef globalObj = JSContextGetGlobalObject(jsContext);
	JSStringRef str = JSStringCreateWithUTF8CString("AAMP");
	JSValueRef aamp = JSObjectGetProperty(jsContext, globalObj, str, NULL);
	if (aamp == NULL)
	{
		JSStringRelease(str);
		return;
	}
	JSObjectRef aampObj = JSValueToObject(jsContext, aamp, NULL);
	if (aampObj == NULL)
	{
		JSStringRelease(str);
		return;
	}
	AAMP_finalize(aampObj);
	JSObjectSetProperty(jsContext, globalObj, str, JSValueMakeUndefined(jsContext), kJSPropertyAttributeReadOnly, NULL);
	JSStringRelease(str);
	LOG("[AAMP_JS] JSGarbageCollect() context=%p", context);
	JSGarbageCollect(jsContext);
}
void aamp_UnloadJS ( void * context ) { INFO ( " " , __FUNCTION__ , context ) ; JSGlobalContextRef jsContext = ( JSGlobalContextRef ) context ; JSObjectRef globalObj = JSContextGetGlobalObject ( jsContext ) ; JSStringRef str = JSStringCreateWithUTF8CString ( " " ) ; JSValueRef aamp = JSObjectGetProperty ( jsContext , globalObj , str , NULL ) ; if ( aamp == NULL ) { JSStringRelease ( str ) ; return ; } JSObjectRef aampObj = JSValueToObject ( jsContext , aamp , NULL ) ; if ( aampObj == NULL ) { JSStringRelease ( str ) ; return ; } AAMP_finalize ( aampObj ) ; JSObjectSetProperty ( jsContext , globalObj , str , JSValueMakeUndefined ( jsContext ) , kJSPropertyAttributeReadOnly , NULL ) ; JSStringRelease ( str ) ; LOG ( " " , context ) ; JSGarbageCollect ( jsContext ) ; }
@brief  Removes the AAMP instance from JS context
   @param[in]  context - JS execution context
@brief Removes the AAMP instance from JS context @param [ in ] context - JS execution context
// Force a garbage collection to clean-up all AAMP objects.