@vitaliyg One solution to accessing CMS data when using externally hosted javascript is store the CMS data in session storage when the page loads.
<script>
window.sessionStorage.setItem("KEY", "{{ CMS_FIELD }}" ) // Replace {{ CMS_FIELD }} with the CMS variable in the custom code editor. Make sure to include the "" around the CMS variable otherwise the browser will throw a ReferenceError (unless you the value is a number or boolean).
</script>
Do this for each of the CMS fields you want to be able to access.
Also ensure that this code is executed before your external JS file.
The below code can be used in your external JS to get the values:
<script>
window.sessionStorage.getItem("key")
</script>
You could also create a single object containing the all of the key/value pairs, stringify it, and then store the string as a single sessionStorage item.
<script>
var jsonStr = JSON.stringify({ slug: "my-page" })
window.sessionStorage.setItem( "WF_CMS_DATA", jsonStr )
</script>
Then access it with
<script>
var jsonStr = window.sessionStorage.getItem("WF_CMS_DATA")
var obj = JSON.parse(jsonStr)
console.log(obj.slug) // will log "my-page" to the JS console
</script>