void SRPWindows::SetDefaultCallBackFunctions()
{
	// bind the default javascript functions for use
	/*Awesomium::JSValue cJSDragWindow = GetAwesomiumWindow()->CreateGlobalJavascriptObject(Awesomium::WebString::CreateFromUTF8(String(DRAGWINDOW).GetUTF8(), String(DRAGWINDOW).GetLength()));
	GetAwesomiumWindow()->CreateGlobalJavascriptObject(Awesomium::WebString::CreateFromUTF8(String(HIDEWINDOW).GetUTF8(), String(HIDEWINDOW).GetLength()));
	GetAwesomiumWindow()->CreateGlobalJavascriptObject(Awesomium::WebString::CreateFromUTF8(String(CLOSEWINDOW).GetUTF8(), String(CLOSEWINDOW).GetLength()));

	Awesomium::JSObject cJSObject = cJSDragWindow.ToObject();

	cJSObject.SetCustomMethod(Awesomium::WebString::CreateFromUTF8(String(DRAGWINDOW).GetUTF8(), String(DRAGWINDOW).GetLength()), false);

	DebugToConsole("last error: '" + String(GetAwesomiumWindow()->last_error()) + "'\n");*/



	Awesomium::JSValue cJSTest = GetAwesomiumWindow()->CreateGlobalJavascriptObject(Awesomium::WebString::CreateFromUTF8("external", 5));

	if (cJSTest.IsObject())
	{
		Awesomium::JSObject cJSObject = cJSTest.ToObject();

		cJSObject.SetCustomMethod(Awesomium::WebString::CreateFromUTF8("hello", 5), false);

		if (cJSObject.HasMethod(Awesomium::WebString::CreateFromUTF8("hello", 5)))
		{
			DebugToConsole("last error: '" + String(GetAwesomiumWindow()->last_error()) + "'\n");
		}
	}
}
Example #2
0
		void MethodHandler::BindWithRetval(Awesomium::JSObject &object, const Awesomium::WebString &name, JSDelegateWithRetval callback)
		{
			if (object.type() == Awesomium::kJSObjectType_Local)
			{
				return;
			}

			object.SetCustomMethod(name, true);

			object_method_key_t key(object.remote_id(), name);
			m_bound_methods_with_retval[key] = callback;
		}
		void RootEngine::GUISystem::Dispatcher::BindWithRetVal( Awesomium::JSObject& p_object, const Awesomium::WebString& p_name, JSDelegate1WithRetval p_callback )
		{
			// We can't bind methods to local JSObjects
			if (p_object.type() == Awesomium::kJSObjectType_Local)
			{
				g_context.m_logger->LogText(LogTag::GUI, LogLevel::NON_FATAL_ERROR, "Cannot bind methods to local JSObjects");
				return;
			}

			p_object.SetCustomMethod(p_name, true);

			ObjectMethodKey key(p_object.remote_id(), p_name);
			m_boundMethodsWithRetVal[key] = p_callback;
		}
Example #4
0
void RomCommon::RomJSHandler::AddGlobalJSObject(Awesomium::JSObject object)
{
	if(this->IsJSObject(object.remote_id()))
	{
		Logger::getInstance()->Log("RomJSHandler :: Global JS object already registered", LOG_WARNING);
		return;
	}

	this->_globalJSObjectList.push_back(object);
}