| 135 | | === !JavaScript Extension on Windows === |
| 136 | | Currently HTMLGfx can pass information to the HTML DOM via the 'window.external' extension. |
| 137 | | |
| 138 | | ==== Methods ==== |
| 139 | | |
| 140 | | || Name || Returns || Description || |
| 141 | | || log(string) || void || Logs a message to stderrgfx.txt || |
| 142 | | || debug(string) || void || Logs a message with a category of 'DEBUG' to stderrgfx.txt || |
| 143 | | || info(string) || void || Logs a message with a category of 'INFO' to stderrgfx.txt || |
| 144 | | || warn(string) || void || Logs a message with a category of 'WARNING' to stderrgfx.txt || |
| 145 | | || error(string) || void || Logs a message with a category of 'ERROR' to stderrgfx.txt || |
| 146 | | || isStateUpdated() || Boolean || Returns true if it is time to refresh all the state in the UI || |
| 147 | | || resetStateUpdate(Boolean) || void || Resets the state update flag to the given value || |
| 148 | | |
| 149 | | ==== Properties ==== |
| 150 | | |
| 151 | | || Name || Data Type || Description || |
| 152 | | || appName || string || || |
| 153 | | || appVersion || long || || |
| 154 | | || wuName || string || || |
| 155 | | || resName || string || || |
| 156 | | || teamName || string || || |
| 157 | | || userName || string || || |
| 158 | | || userCreditTotal || float || || |
| 159 | | || userCreditAverage || float || || |
| 160 | | || hostCreditTotal || float || || |
| 161 | | || hostCreditAverage || float || || |
| 162 | | || scrsaveMode || Boolean || Was the graphics application launched in screensaver mode || |
| 163 | | || suspended || Boolean || Whether the task is currently suspended || |
| 164 | | || networkSuspended || Boolean || Should the UI suspend Internet activity || |
| 165 | | || exiting || Boolean || Should the UI prepare to exit || |
| 166 | | || exitTimeout || float || || |
| 167 | | || cpuTime || float || || |
| 168 | | || elapsedTime || float || || |
| 169 | | || fractionDone || float || || |
| 170 | | || vboxJob || Boolean || Is this task a vboxwrapper task? || |
| 171 | | || rdpPort || long || || |
| 172 | | || apiPort || long || || |
| 173 | | |
| 174 | | |
| 175 | | ==== Examples ==== |
| 176 | | Example of refreshing the state of various controls: |
| 177 | | {{{ |
| 178 | | refresh() { |
| 179 | | if (window.external.isStateUpdated()) { |
| 180 | | window.external.resetStateUpdate(false); |
| 181 | | username = window.external.userName; |
| 182 | | teamname = window.external.teamName; |
| 183 | | } |
| 184 | | fractiondone = window.external.fractionDone; |
| 185 | | } |
| 186 | | }}} |
| 187 | | |