How to add a surcharge (fee) for a custom payment method?

I’m developing Payment fee for my company? I’m stuck in how to add my custom js. Can I re-use exist function core js or Knockout js?

I don’t know how to create a custom js:
+Check when my custom payment is checked, the surcharge fee will be added to total. I know how to implement an offline payment method.
You can guide me how to implement custom js to check this?

Thanks you!