TITANIUM_FUNCTION(WebView, setHtml)
		{
			std::unordered_map<std::string, std::string> options;

			if (arguments.size() < 1) {
				return get_context().CreateUndefined();
			}

			const auto _0 = arguments.at(0);
			TITANIUM_ASSERT(_0.IsObject());
			const auto html = static_cast<std::string>(_0);

			if (arguments.size() >= 2) {
				const auto _1 = arguments.at(1);
				TITANIUM_ASSERT(_1.IsObject());
				const auto js_options = static_cast<JSObject>(_1);
				// extract JSObject into C++ unordered_map
				for (const auto& property_name : static_cast<std::vector<JSString>>(js_options.GetPropertyNames())) {
					options.emplace(property_name, static_cast<std::string>(js_options.GetProperty(property_name)));
				}
			}
			setHtml(html, options);
			return get_context().CreateUndefined();
		}
Exemplo n.º 2
0
Arquivo: prim.cpp Projeto: lvxejay/USD
std::vector<UsdProperty>
UsdPrim::GetProperties() const
{
    return _MakeProperties(GetPropertyNames());
}