本文整理汇总了C++中JSContext::CreateObject方法的典型用法代码示例。如果您正苦于以下问题:C++ JSContext::CreateObject方法的具体用法?C++ JSContext::CreateObject怎么用?C++ JSContext::CreateObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSContext
的用法示例。
在下文中一共展示了JSContext::CreateObject方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MediaQueryInfoType_to_js
JSObject MediaQueryInfoType_to_js(const JSContext& js_context, const MediaQueryInfoType& config)
{
auto object = js_context.CreateObject();
object.SetProperty("exact", js_context.CreateBoolean(config.exact));
object.SetProperty("value", config.value);
return object;
}
开发者ID:appcelerator-forks,项目名称:appcelerator.titanium_mobile_windows,代码行数:7,代码来源:MediaQueryInfoType.cpp
示例2: AcceptDict_to_js
JSObject AcceptDict_to_js(const JSContext& js_context, const AcceptDict& config)
{
auto object = js_context.CreateObject();
object.SetProperty("error", config.error);
object.SetProperty("timeout", js_context.CreateNumber(static_cast<double>(config.timeout.count())));
return object;
}
示例3: RectToJS
JSObject AppModule::RectToJS(const JSContext& js_context, const Windows::Foundation::Rect& rect)
{
auto obj = js_context.CreateObject();
obj.SetProperty("width", js_context.CreateNumber(rect.Width));
obj.SetProperty("height", js_context.CreateNumber(rect.Height));
obj.SetProperty("x", js_context.CreateNumber(rect.X));
obj.SetProperty("y", js_context.CreateNumber(rect.Y));
return obj;
}
示例4: Gradient_to_js
// TODO: implement this
JSObject Gradient_to_js(const JSContext& js_context, const Gradient& gradient)
{
auto object = js_context.CreateObject();
object.SetProperty("type", js_context.CreateNumber(static_cast<std::underlying_type<GRADIENT_TYPE>::type>(gradient.type)));
object.SetProperty("backfillStart", js_context.CreateBoolean(gradient.backfillStart));
object.SetProperty("backfillEnd", js_context.CreateBoolean(gradient.backfillEnd));
object.SetProperty("endRadius", js_context.CreateNumber(gradient.endRadius));
object.SetProperty("startRadius", js_context.CreateNumber(gradient.startRadius));
return object;
}
示例5:
JSObject MapRegionTypev2_to_js(const JSContext& js_context, MapRegionTypev2 value)
{
auto object = js_context.CreateObject();
object.SetProperty("bearing", js_context.CreateNumber(value.bearing));
object.SetProperty("latitude", js_context.CreateNumber(value.latitude));
object.SetProperty("latitudeDelta", js_context.CreateNumber(value.latitudeDelta));
object.SetProperty("longitude", js_context.CreateNumber(value.longitude));
object.SetProperty("longitudeDelta", js_context.CreateNumber(value.longitudeDelta));
object.SetProperty("tilt", js_context.CreateNumber(value.tilt));
object.SetProperty("zoom", js_context.CreateNumber(value.zoom));
return object;
}
示例6: CameraMediaItemType_to_js
JSObject CameraMediaItemType_to_js(const JSContext& js_context, const CameraMediaItemType& config)
{
auto object = js_context.CreateObject();
object.SetProperty("code", js_context.CreateNumber(config.code));
object.SetProperty("cropRect", Titanium::UI::Dimension_to_js(js_context, config.cropRect));
object.SetProperty("error", js_context.CreateString(config.error));
if (config.media != nullptr) {
object.SetProperty("media", config.media->get_object());
}
object.SetProperty("mediaType", js_context.CreateNumber(static_cast<std::uint32_t>(config.mediaType)));
object.SetProperty("success", js_context.CreateBoolean(config.success));
return object;
}
开发者ID:appcelerator-forks,项目名称:appcelerator.titanium_mobile_windows,代码行数:13,代码来源:CameraMediaItemType.cpp
示例7: PushNotificationConfig_to_js
JSObject PushNotificationConfig_to_js(const JSContext& js_context, const PushNotificationConfig& config)
{
auto object = js_context.CreateObject();
object.SetProperty("callback", config.callback);
object.SetProperty("error", config.error);
object.SetProperty("success", config.success);
std::vector<JSValue> js_types;
for (const auto t : config.types) {
js_types.push_back(js_context.CreateNumber(Titanium::Network::Constants::to_underlying_type(t)));
}
object.SetProperty("types", js_context.CreateArray(js_types));
return object;
}
开发者ID:appcelerator-forks,项目名称:appcelerator.titanium_mobile_windows,代码行数:15,代码来源:PushNotificationConfig.cpp
示例8: ConstructorInitializeCallback
void JSClass::ConstructorInitializeCallback(const JSContext& js_context, JSObject& this_object) const {
if (!this_object.HasProperty("prototype")) {
auto js_object = js_context.CreateObject();
this_object.SetProperty("prototype", js_object);
}
auto proto_object = static_cast<JSObject>(this_object.GetProperty("prototype"));
for (const auto v : prototype_functions_map__) {
//
// NOTE: On HAL, there's no difference between object "static" property and prototype property
// so add it to both
//
this_object.SetProperty(v.first, JSObjectMakeFunctionWithCallback(js_context, v.first, v.second));
proto_object.SetProperty(v.first, JSObjectMakeFunctionWithCallback(js_context, v.first, v.second));
}
}
示例9: ShowContactsParams_to_js
JSObject ShowContactsParams_to_js(const JSContext& js_context, const ShowContactsParams& dict)
{
auto object = js_context.CreateObject();
object.SetProperty("animated", js_context.CreateBoolean(dict.animated));
object.SetProperty("cancel", dict.callbacks.cancel);
std::vector<JSValue> js_fields;
for (const auto f : dict.fields) {
js_fields.push_back(js_context.CreateString(f));
}
object.SetProperty("fields", js_context.CreateArray(js_fields));
object.SetProperty("selectedPerson", dict.callbacks.selectedPerson);
object.SetProperty("selectedProperty", dict.callbacks.selectedProperty);
return object;
};
开发者ID:appcelerator-forks,项目名称:appcelerator.titanium_mobile_windows,代码行数:16,代码来源:ShowContactsParams.cpp
示例10: RouteDescription_to_js
JSObject RouteDescription_to_js(const JSContext& js_context, const RouteDescription& config)
{
auto object = js_context.CreateObject();
std::vector<JSValue> js_inputs;
for (const auto v : config.inputs) {
js_inputs.push_back(js_context.CreateNumber(static_cast<std::uint32_t>(v)));
}
std::vector<JSValue> js_outputs;
for (const auto v : config.outputs) {
js_outputs.push_back(js_context.CreateNumber(static_cast<std::uint32_t>(v)));
}
object.SetProperty("inputs", js_context.CreateArray(js_inputs));
object.SetProperty("outputs", js_context.CreateArray(js_outputs));
return object;
}
示例11: loadJS
bool Analytics::loadJS()
{
if (ti_analytics__.HasProperty("lastEvent") && ti_analytics__.HasProperty("featureEvent") && ti_analytics__.HasProperty("navEvent")) {
return true;
}
JSContext context = get_context();
auto export_object = context.CreateObject();
export_object.SetProperty("global", context.get_global_object());
context.JSEvaluateScript(analytics_js, export_object);
if (export_object.HasProperty("exports")) {
ti_analytics__ = static_cast<JSObject>(export_object.GetProperty("exports"));
} else {
return false;
}
return true;
}
示例12: Emails_to_js
JSObject Emails_to_js(const JSContext& js_context, const Emails& emails)
{
auto object = js_context.CreateObject();
std::vector<JSValue> js_home;
for (const auto email : emails.home) {
js_home.push_back(js_context.CreateString(email));
}
object.SetProperty("home", js_context.CreateArray(js_home));
std::vector<JSValue> js_work;
for (const auto email : emails.work) {
js_work.push_back(js_context.CreateString(email));
}
object.SetProperty("work", js_context.CreateArray(js_work));
std::vector<JSValue> js_other;
for (const auto email : emails.other) {
js_other.push_back(js_context.CreateString(email));
}
object.SetProperty("other", js_context.CreateArray(js_other));
return object;
};