Flames dancing - transmitting parameter through callback feature

I am working on a code where I pass a function from javascript

exportManager.RegisterCallbacks(function(progress) {
                                console.log("export prog " + progress);
                             }, function() {
                                console.log("Export Done");
                             }, function() {
                                console.log("Export Error");
                             }, function() {
                                console.log("Export Abort");
                             });

Within the plugin

m_currentExportProgress += progress;
int prog = (m_currentExportProgress.load() / m_totalProgress) * 100;

m_onProgress->InvokeAsync("", FB::variant_list_of(shared_from_this())(prog));

However, when I display the result, it shows

 export prog <JSAPI-Auto Javascript Object>

Answer №1

Acknowledged, your current code is functioning exactly as intended. You are inputting two parameters into the callback: firstly, a reference to your JSAPI instance shared_from_this() and secondly, prog.

If you wish to only pass one parameter, simply provide one argument:

m_onProgress->InvokeAsync("", FB::variant_list_of(prog));

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Quickly Share Documents within a Folder

I currently have a server set up with the following file structure: - index.js /client -index.html -about.html -signup.html -style.css Within the index.js file, I have implemented an express server. When the user navigates to /, it should display the ...

I was confused about the distinction between the https.get() and https.request() functions in the Node.js npm package for https

// # Exciting Nodejs Programs! const https = require('https'); https.get('https://www.google.com/', (res) => { console.log('statusCode:', res.statusCode); console.log('headers:', res.headers); res.on ...

The date picker feature of Jquery Mobile is not appearing on the popup field

I implemented the jtsage jquery mobile date picker, and I am facing an issue where the date picker appears behind the popup instead of in front of it when the text inside the popup is clicked. Here is a snippet of my code: <div data-role="content"> ...

Tips for Sending Information to the Current Page Using JQuery

I am attempting to send the form data back to the same location as the form itself. The code needs to: Trigger the click action for #submit Retrieve data from #email, #selection1, and #selection2 Hide the form #form Show the data in #email, #selection1, ...

Struggling to access a PHP variable in a JavaScript file through AJAX

After studying numerous examples on how to pass a PHP variable to a JavaScript file, I have yet to successfully accomplish it. This is my PHP file: $title = $json["title"]; echo json_encode($title); And here is my app.js JavaScript file: $.ajax({ ...

Sending a JWT token to a middleware with a GET request in Express Node.js - the proper way

Struggling with Js and web development, I've scoured the web for a solution to no avail... After completing a project for a small lab, my current challenge is creating a login page and generating a web token using JWT... I successfully created a use ...

Send a request to templateUrl

After experimenting with AngularJS, I decided to create a dynamic route system that funnels all routes through a single PHP file. This was motivated by my desire to prevent users from accessing raw templateUrl files and seeing unstyled partial pages. Prio ...

Error not identified in ajax function for form submission

For some reason, in IE8 specifically, the alert function is not firing and the ajax part of my code is not running when I try to submit a form. Even though I have included a return false, the form still gets submitted. Why is this issue only occurring in ...

Query regarding timing in JavaScript

I recently started learning JavaScript and I am facing a challenge with running a check to determine if it is daylight. Currently, I am using Yahoo's weather API to retrieve information about sunrise and sunset times. The issue I have encountered is h ...

Using RxJS v5 for Sending a POST Request with Parameters

Snippet of my RxJS code: .mergeMap(action => { const user = store.getState().user; return ajax.post(`${config.API_BASE_URL}/api/v1/rsvps`, { rsvp: { meetup_id: action.payload, user_id: user.id, } }) .map(action => calenda ...

How can I adjust the top margin of a legend that is placed at the bottom of a Doughnut chartjs graph?

I've been working on customizing doughnut graphs with ChartJS and I'm struggling to create space between the graph and the legend. Here's my legend configuration: plugins: { legend: { display: true, align: 'start', p ...

Display text automatically if the user fails to click on the image after a certain period

I'm working on a jQuery code but I'm not sure how to achieve this specific functionality. I want the text to show up automatically after a few seconds if the user doesn't click on the image. Do you think adding animation-delay in CSS would b ...

Unable to Achieve Full Height with Vuetify Container

Challenge: I'm facing an issue with my <v-container> component not consistently spanning the entire height of the application. Despite trying various methods such as using the fill-height property, setting height: 100%;, height: 100vh;, and expe ...

Error encountered: GL_INVALID_OPERATION in three.js while executing glDrawArrays: trying to access vertices outside the valid range in attribute 1

I've been struggling with this issue for quite some time now. I am in the process of creating a game, and the main map is a model in obj format. I load it using the following code snippet: var objLoader = new THREE.OBJLoader(); objLoader.setPath(&apos ...

"ModuleNotFound" error occurred when attempting to utilize Netlify lambda functions with external dependencies

https://i.stack.imgur.com/vVmky.jpg I'm currently exploring the capabilities of Netlify, specifically its lambda function feature for running a node function with dependencies. Following a tutorial from CSS-Tricks, my functions/submission-created.js ...

What are the steps to integrate HJSON with Jest in a create-react-app development environment?

Currently, I am utilizing HJSON within a create-react-app project (view answer here). However, Jest does not utilize the same webpack configuration, resulting in a failed import of HJSON - for instance, import options from '../assets/options.hjson&ap ...

Having trouble adding a div in React due to the error "Objects are not allowed as a React child"?

While I am rendering the data and displaying it between divs, I keep getting this error: Objects are not valid as a React child (found: Wed Dec 09 1998 00:00:00 GMT+0530 (India Standard Time)). If you meant to render a collection of children, use an ...

Is it possible to retrieve JSON data from an external URL using JavaScript or jQuery?

My goal is to retrieve JSON data from the following URL: I have a button that triggers the function called "jsonplz()", which should display an alert message with the fetched JSON data. This is what my JavaScript code looks like: <script src="htt ...

creating dynamic lists in angular.js

Could you please guide me on creating a dynamic list in Angular.js? I have successfully implemented a feature where users can add items to the list by clicking a button and filling out the required fields. To see this in action, check out this fiddle: http ...

A promise is given when a value triggers a function

Having a problem with my code in the second function. When I log inside the function, it works fine. But when I assign a variable and call the function, it returns a pending promise instead of true or false. const mongoose = require('mongoose') c ...