Skip to content

How to force image refresh on every panel load/refresh #191

Answered by ZuperZee
arminus asked this question in Q&A
Discussion options

You must be logged in to vote

You are using document.getElementById, which is usually not what you want. To get elements in the panel, you should use the htmlNode instead of document.

Example

Code used to serve the image: https://github.com/ZuperZee/serve-refresh-images

HTML

<img id="myimage" src="plain/url/image.png">

onInit

const image = htmlNode.querySelector("img");
const currentTime = new Date().getTime();
image.src = "http:https://localhost:3000?timestamp=" + currentTime;

Panel options (https://gapit-htmlgraphics-panel.gapit.io/docs/guides/how-to-import-export/)

{
    "calcsMutation": "standard",
    "reduceOptions": {
        "calcs": [
            "lastNotNull",
            "last",
            "firstNotNull",
     …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@arminus
Comment options

Answer selected by arminus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants