JavaScript function with multiple parameters inspired by Objective-C methodology

Currently, I am developing an appcelerator module using Xcode and programming in obj-C.

One of the methods I have created accepts multiple arguments, as shown below:

 -(void)useThis:(NSString*)this withThat:(NSString*)that{}

My question is, how do I invoke this method in appcelerator? What is the correct syntax to use?

 var foo = require("module");
 foo.useThiswithThat("this","that");

I've attempted the above code but it doesn't appear to be working.

Answer №1

Uncertain of its effectiveness, I have doubts about whether that method will actually work.

During my experience developing modules for Titanium, I approached a similar situation by utilizing the following code:

-(void)implementThisAndThat:(NSArray *)thisThat
{
    // This method processes an array containing both "this" and "that"
}

This method was then invoked as follows:

foo.useThisandThat(["this","that"]);

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

When dealing with a UITableView that filters search results, how can I maintain a consistent IndexPath in ViewDidLoad() regardless of any active searches?

Currently, I am facing an issue with setting up a UITableView that is searchable. Upon loading the view, there are a total of 23 cells, so the indexPath ranges from 0 to 22. For example, if the third cell is clicked, it returns an indexPath of 2. However ...

Ways to output a string array from a JSON object containing additional attributes

On the client side, I have received a JSON object from a REST service. This object contains multiple attributes, one of which is a String array. I need guidance on how to display this array using embedded AngularJS code in HTML. Here is my JSON object: [ ...

Tips for resolving the error of encountering a forbidden and unexpected token in JSON at position 0 while using React hooks

const [forecastData, setForecastData] = useState({ forecast: []}); useEffect(() => { let ignore = false; const FETCHDATA = async () => { await fetch(forecast,{ headers : { ...

Steps for removing access to IOS apps from an enterprise account with outdated versions; not the latest ones

I recently released an app with older versions that do not have the force push update feature. As a result, newer versions of the app can be forced to update and include analytics features. The older versions lack both analytics and force push capabiliti ...

The `appendTo` function in Ajax is used to swap out the current element

I have been working on sending form data to a Servlet using JQuery and then receiving the response from the same JQuery. Check out the code snippet below. <%-- Document : index Created on : Feb 23, 2015, 8:18:52 PM Author : Yohan --% ...

Access the web location using jQuery's ajax functionality

I need help figuring out how to post data to my "mail.py" script without knowing the URL link. Both my jQuery AJAX code and JavaScript file are located in RKProjects/scripts_js/contactform.js The Python script I want to connect to is stored in RKProjects ...

Sorting Tables - My goal is to ensure that when sorting parent rows, the child rows are also correctly moved along with them

Can I sort parent rows and move child rows along with them using JavaScript? Here is an example of my table structure: <table> <tr class="parent"> <th id="apple">Apple</th> <th id="orange">Orange</th> ...

Incorporating a timer feature into the code for my memory game

Seeking the optimal method to incorporate a timer into my memory game. This game comprises numerous squares, and when the user successfully completes it, a modal appears congratulating them on their win and providing an option to restart the game. The obj ...

Encountering the error "ReferenceError: __extends is not defined" is a common issue when modifying the rollup.config.js commonjs function in projects that use the ReactJS library

Currently, I am involved in a project and there is also a library project containing all the common components used throughout. Within this library, I had to integrate a component that relies on materialUI. However, upon trying to export this component, I ...

How to retrieve the chosen option from a drop-down menu created within a loop in a React application

I am seeking guidance on the best way to create multiple drop-down menus (<select>) using a loop, so that I can retrieve their selected values using a button. I have attempted to replicate what is currently in my code, hoping this information is suff ...

Retrieve JSON data from an HTTP request using Node.JS

Hi there, I'm struggling with the Node.js HTTPS request. Basically, I send a request to a server and it responds with a JSON message that I need to parse and save in a variable so I can use it in other functions. let obj=JSON.parse(response); return ...

Listening for button clicks in a Bootstrap drop down menu using JavaScript

I'm struggling to figure out how to detect button clicks in a drop-down menu. I've tried using Array.from to assign an event listener to each button in the drop-down, but it doesn't seem to work efficiently. It feels inefficient to assign in ...

External JavaScript file not executing defined function

My homepage includes a register form that should open when the register button is clicked. However, I am encountering an issue where the function responsible for opening the form from another JavaScript file is not being triggered. Here is the HTML code: ...

AngularJS: Refresh array following the addition of a new item

After saving an object, I am looking to update an array by replacing the conventional push method with a custom function. However, my attempts have not been successful so far. Are there any suggestions on how to rectify this issue? app.controller("produ ...

Utilizing variable values in HTML and CSS to enhance a website's functionality

My current project involves modifying an HTML web resource for use in Dynamics 365. I need to replace a static URL with a dynamic value obtained via Javascript, specifically: var URL = Xrm.Page.context.getClientUrl(); There are multiple instances within ...

I am seeking a way to eliminate double quotation marks from a string without using the replace function

I need assistance in removing double quotes from the string "Hello". I have an array var ary = ['a', 'b' , 'c'] When I extract a value from the array, it returns the value in string format, such as ary[0] = "a", but I want i ...

The .push method in Javascript is failing to execute

I'm facing a challenge with this particular code snippet. Essentially, I am attempting to loop through an array of Word objects and categorize them based on word type using a switch statement. This process is triggered by jQuery listening for a button ...

Ways to detect the playback status of MPMoviePlayer

Working on creating a custom UI for a movie player on iPhone. One challenge I'm facing is when playing an internet video using a URL, the internet connection might not always be reliable. If the video pauses due to poor internet or doesn't start ...

Update the `name` attributes of input elements following the retrieval of HTML data from an action using AJAX in an ASP

I am working on a basic ajax request that retrieves a generated HTML from the server. Here is the code snippet: $.ajax({ url: '/GetData' type: "POST", dataType: "html", data: ..., success: function(data) { // In this ...

Imitate a worldwide entity with Jest and Typescript

I have a React component that utilizes the global object Routes provided by the Rails gem js-routes. My component is being tested with Jest's snapshot testing feature. The issue arises when trying to mock the Routes global object in the test to return ...