# How to "run" a function on JavaScript via Reference?

**URL:** <https://discuss.dev.twitch.com/t/how-to-run-a-function-on-javascript-via-reference/25335>\
**Category:** Extensions\
**Created:** [May 3, 2020, 2:14pm UTC](https://discuss.dev.twitch.com/t/how-to-run-a-function-on-javascript-via-reference/25335 "2020-05-03T14:14:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robot](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Robot](https://discuss.dev.twitch.com/u/Robot)\
**Post date:** [May 3, 2020, 2:14pm UTC](https://discuss.dev.twitch.com/t/how-to-run-a-function-on-javascript-via-reference/25335/1 "2020-05-03T14:14:22Z")

</div>

I am new to studying JavaScript, and I have a function written in JavaScript that starts a simple countdown display, but I had a question how I can “run” this function by building a “one-way” connection from my project to extension using Reference ([Link](https://dev.twitch.tv/docs/extensions/reference#set-extension-configuration-segment))? Please tell me what “EndPoint” should I use in this case?  
And do I understand correctly - in order for all this to work, I need to write a file BackEnd.js, which will describe what will happen during the request from my project to the extension?

---

<div class="post-metadata">

**Author:** ![Breci](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/breci/32/5635_2.png) [@Breci](https://discuss.dev.twitch.com/u/Breci)\
**Post date:** [May 3, 2020, 3:30pm UTC](https://discuss.dev.twitch.com/t/how-to-run-a-function-on-javascript-via-reference/25335/2 "2020-05-03T15:30:48Z")

</div>

Basically you want to trigger a countdown on your extension from your backend or the configuration view?

If you want to send real time messages you can use the extension pubsub [https://dev.twitch.tv/docs/extensions/reference/#send-extension-pubsub-message](https://dev.twitch.tv/docs/extensions/reference/#send-extension-pubsub-message)

And use the listen methods from the javascript helper to get the message sent by your server and call your javascript function on your frontend [https://dev.twitch.tv/docs/extensions/reference/#helper-extensions](https://dev.twitch.tv/docs/extensions/reference/#helper-extensions)
