'How can I replace element in vue.js?

Here's my code:

window.onload = (event) => {
            new Vue({
                el: "#test",
                mounted: function() {
                    this.fetch();
                    setInterval(this.fetch, 60000);
                },
                data: function() {
                    return {
                        tracker: {
                            serverInfo: {
                                servername: ""
                            }
                        }
                    }                       
                },              
                methods: {
                    fetch() {
                        fetch("https://pt.dogi.us/ParaTrackerDynamic.php?ip=pug.jactf.com&port=29071&skin=JSON")
                        .then(response => response.json())
                        .then(data => {this.tracker = data});
                    },                  
                }       
            })
        }
<script src="https://unpkg.com/[email protected]/dist/vue.min.js"></script>
<div id="test">

<span style="font-weight:bold">SERVER NAME:</span> {{tracker.serverInfo.servername}}

Using vue.js how can I replace ^4Re^5fresh^11-PUG output element to

<span style="font-weight:bold">SERVER NAME:</span> <span style="color:blue">Re</span><span style="color:cyan">fresh</span><span style="color:red">1-PUG</span>

where ^4 stands for <span style="color:blue"> etc

Final result should looks like this: image



Solution 1:[1]

Speed of execution depends on your device's computing capabilities, you can't expect results to be quicker than that.

As per my experience, using Dispatchers.Default is the fastest way to get this done. Few other pointers to note —

  1. Check whether your heavy computation could be parallelized by launching multiple coroutines operating on unique data (SIMD).
  2. Check whether you could take advantage of the device's GPU capabilities using some Rederscript alternatives mentioned here
  3. You may schedule an Expedited Work from the WorkManager if you want your operation to continue when the app is not in the foreground, but this again adds the complexity of WorkManager scheduling and you won't find it quicker than using Dispatchers.Default explicitly.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kshitij Patil