15 #include "precompiled_headers.h"
16 #include "JSFunction.h"
25 : FB::JSAPIAuto(zone, func +
"()"), m_apiWeak(obj), m_methodName(func)
30 void FB::JSFunction::init()
32 m_allowMethodObjects =
false;
34 m_reservedMembers.clear();
37 FB::variant FB::JSFunction::exec(
const std::vector<variant>& args )
44 return api->Invoke(m_methodName, args);
47 FB::variant FB::JSFunction::call(
const std::vector<variant>& args )
50 if (args.size() >= 1) {
51 list.insert(list.end(), args.begin()+1, args.end());
56 FB::variant FB::JSFunction::apply(
const std::vector<variant>& args )
59 if (args.size() >= 2) {
68 if (methodName ==
"" || methodName ==
"apply" || methodName ==
"call") {
77 if (methodName ==
"") {
79 }
else if (methodName ==
"call") {
81 }
else if (methodName ==
"apply") {
90 if (propName ==
"call" || propName ==
"apply")
virtual bool HasMethod(const std::wstring &methodName) const
virtual variant Invoke(const std::wstring &methodName, const std::vector< variant > &args)
Accepts any datatype, used in all interactions with javascript. Provides tools for getting back out t...
std::vector< variant > VariantList
Defines an alias representing list of variants.
boost::weak_ptr< FB::JSAPI > JSAPIWeakPtr
Defines an alias for a JSAPI weak_ptr (you should never use a JSAPI* directly)
int SecurityZone
Used to set a SecurityZone for a method or property – used by JSAPIAuto.
virtual bool HasProperty(const std::string &propertyName) const
Query if 'propertyName' is a valid property.
virtual bool HasMethod(const std::string &methodName) const
Query if the JSAPI object has the 'methodName' method.
boost::shared_ptr< FB::JSAPI > JSAPIPtr
Defines an alias for a JSAPI shared_ptr (you should never use a JSAPI* directly)
Provides a helper class for locking.
Exception type; when thrown in a JSAPI method, a javascript exception will be thrown.
std::string wstring_to_utf8(const std::wstring &src)
Accepts a std::wstring and returns a UTF8-encoded std::string.
virtual variant Invoke(const std::string &methodName, const std::vector< variant > &args)
Called by the browser to invoke a method on the JSAPI object.
virtual bool HasProperty(int idx) const
Query if the property at "idx" exists.