Skip to content

Conversation

@OnkarRuikar
Copy link

The PR adds an option to provide extra script to further customize the client script (that is appended at the end of served HTML page).

For example, to view logs we want to scroll to bottom every time the page reloads. Following JavaScript can be appended to the reload script:

// FILE: reload-addon.js
// scroll to bottom on load
window.addEventListener('load', () => {
  window.setTimeout(()=>window.scrollTo(0, document.body.scrollHeight), 50);
});

To tell reload server about the extra script to append use option -a:

reload -d "/sensor/logs/" -a "/home/user/bin/reload-addon.js"

This will make reload server provide following reload.js:

// default reload.js code
...
})()


// Add-on code
// FILE: reload-addon.js
// scroll to bottom on load
window.addEventListener('load', () => {
  window.setTimeout(()=>window.scrollTo(0, document.body.scrollHeight), 50);
});

Using this, depending on the application requirements, custom features (like floating menus, highlighting, scrolling etc) can be added to the served pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant