AutoRefresh component
Usage
NPM
# npm install six-auto-refresh
import AutoRefresh from 'six-auto-refresh'
// initialize with a session from SDK
let manager = AutoRefresh(session,
{
// refresh data every 10s
interval: 10,
// stop auto-refresh after 10min
timeout: 10*60,
// stop auto-refresh after 3min non-activity
idleTimeout: 3*60,
// callback that should return true when auto-refresh is enabled
enabled: function() { return true },
// callback called when auto-refresh is enabled/disabled
onStateChange: function (isEnabled) { return }
})
// pause auto-refresh
manager.stop()
// restart auto-refresh after pause or timeout
manager.restart()
CDN
<script type="text/javascript" src="https://cdn.six.se/js/six-auto-refresh/0/six-auto-refresh.min.js" />
// initialize with session from SDK
Six.Components.AutoRefresh(session,
{
// refresh data every 10s
interval: 10,
// stop auto-refresh after 10min
timeout: 10*60,
// stop auto-refresh after 3min non-activity
idleTimeout: 3*60,
// callback that should return true when auto-refresh is enabled
enabled: function() { return true },
// callback called when auto-refresh is enabled/disabled
onStateChange: function (isEnabled) { return }
})