Are you looking for something like this: https://docs.mendix.com/howto/extensibility/create-native-javascript-action/ ?