Timer features are also aviable as a Javascript API. You can start, stop and pause the timer. When stopping
the timer you can set the 'silent' attribute to true to skip the JSF listener.
Source
<p:growl id="growl" showDetail="true" showSummary="true">
<p:autoUpdate />
</p:growl>
<pe:timer
widgetVar="timer"
timeout="10000"
forward="true"
listener="#{jsApiTimerController.listener}"
singleRun="false"/>
<hr/>
<p:commandButton value="Start" onclick="PF('timer').start()" type="button"/>
<p:commandButton value="Pause" onclick="PF('timer').pause()" type="button"/>
<p:commandButton value="Restart" onclick="PF('timer').restart()" type="button"/>
<p:commandButton value="Stop" onclick="PF('timer').stop()" type="button"/>
<p:commandButton value="Stop (Silent)" onclick="PF('timer').stop(true)" type="button"/>
@Named
@ViewScoped
public class JsApiTimerController implements Serializable {
private static final long serialVersionUID = 1L;
public void listener() {
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_INFO, "Stopped", null));
}
}