Drupal 8 – theme()

Hello in drupal 8 theme() function was deleted. I am porting one module to d8.

I have one problem, I need parse template and some variable. In d7 its

 $variable = theme('name template,$var);

and next step it’s send to other services by js.

I have problem with d8, I convert template to twig and have $variable. How to parse twig tempate and save to variable?

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/4/feed