Re: What's heartbeat ?
First result with a google search tapestry 5 heartbeat: http://tapestry.formos.com/nightly/tapestry5/apidocs/org/apache/tapestry/services/Heartbeat.html Kalle On 1/6/08, Michael Courcy [EMAIL PROTECTED] wrote: Hi list, As I start to read the code on components I often see heartbeat @Environmental private Heartbeat heartbeat; with heartbeat.begin and heartbeat.end Can someone explain the role of this object and its methods invocations (begin and end) beacause it's not really clear in my mind. Thanks a lot. -- Michael Courcy http://courcy.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's heartbeat ?
Yes thanks, I've done this first of course. It's a start but it does not bring so much light in my point of view. For instance : it does not say what's the difference between calling formSupport.defer or heartbeat.defer, do you see the difference and the conscequences on request treatment or event treatment ? If you look at this exemple : TreeGridComponent http://tapestry5-treegrid.googlecode.com/svn/trunk/tapestry5-treegrid/src/main/java/org/codelutin/tapestry/components/TreeGrid.java a hearbeat.begin is called in beginRender and heartbeat.end is called in afterRender but you can never read a call to defer, so can you explain why the author of this component call begin and end ? I really can't explain myself. What's going on if many components on a page use heartbeat, each component have its own heartbeat system, or is there a general heartbeat rythm, and each component register to it through the call to begin, end and defer ? Can two different heartbeat join and in which circumstances? Especially if a componnent contains another component ? Mybe heartbeat is something very simple and the word heartbeat make me think it's bigger but I don't find that so clear when I start to read it in real components. Michael Kalle Korhonen a écrit : First result with a google search tapestry 5 heartbeat: http://tapestry.formos.com/nightly/tapestry5/apidocs/org/apache/tapestry/services/Heartbeat.html Kalle On 1/6/08, Michael Courcy [EMAIL PROTECTED] wrote: Hi list, As I start to read the code on components I often see heartbeat @Environmental private Heartbeat heartbeat; with heartbeat.begin and heartbeat.end Can someone explain the role of this object and its methods invocations (begin and end) beacause it's not really clear in my mind. Thanks a lot. -- Michael Courcy http://courcy.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Courcy http://courcy.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's heartbeat ?
Michael Courcy a écrit : If you look at this exemple : TreeGridComponent http://tapestry5-treegrid.googlecode.com/svn/trunk/tapestry5-treegrid/src/main/java/org/codelutin/tapestry/components/TreeGrid.java a hearbeat.begin is called in beginRender and heartbeat.end is called in afterRender but you can never read a call to defer, so can you explain why the author of this component call begin and end ? I really can't explain myself. I've based my component on http://wiki.apache.org/tapestry/Tapestry5HowToCreateYourOwnComponents and http://wiki.apache.org/tapestry/Tapestry5TreeComponent without really understanding how it heartbeat works... As I don't use defer, I don't even know if it is useful... Gabriel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's heartbeat ?
Gabriel Landais a écrit : Michael Courcy a écrit : If you look at this exemple : TreeGridComponent http://tapestry5-treegrid.googlecode.com/svn/trunk/tapestry5-treegrid/src/main/java/org/codelutin/tapestry/components/TreeGrid.java a hearbeat.begin is called in beginRender and heartbeat.end is called in afterRender but you can never read a call to defer, so can you explain why the author of this component call begin and end ? I really can't explain myself. I've based my component on http://wiki.apache.org/tapestry/Tapestry5HowToCreateYourOwnComponents and http://wiki.apache.org/tapestry/Tapestry5TreeComponent without really understanding how it heartbeat works... As I don't use defer, I don't even know if it is useful... Gabriel One point for your honesty. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Courcy http://courcy.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's heartbeat ?
Gabriel Landais a écrit : Michael Courcy a écrit : If you look at this exemple : TreeGridComponent http://tapestry5-treegrid.googlecode.com/svn/trunk/tapestry5-treegrid/src/main/java/org/codelutin/tapestry/components/TreeGrid.java a hearbeat.begin is called in beginRender and heartbeat.end is called in afterRender but you can never read a call to defer, so can you explain why the author of this component call begin and end ? I really can't explain myself. I've based my component on http://wiki.apache.org/tapestry/Tapestry5HowToCreateYourOwnComponents and http://wiki.apache.org/tapestry/Tapestry5TreeComponent without really understanding how it heartbeat works... As I don't use defer, I don't even know if it is useful... Gabriel But do you see a different hehaviour if you remove this two lines ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Courcy http://courcy.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's heartbeat ?
I'm not an expert on this, but I can offer you a real need for defer(). Suppose you have a mixin that attaches some trivial piece of JavaScript to components that use it; for example, a key logger. As far as the JS, what you need to do is register a few DOM event handlers on an element - probably onkeypress or onkeyup, etc. Let's suppose you wrote a class that creates such objects, and all you need to instantiate them is the DOM id of the element. In a simple case all you'd need to do is have your mixin include the javascript and provide a line (like support.addScript()) to instantiate the object in JS code - providing the component id, which I think you can get through something like ComponentResources. Now, if in your template code you have one component for which you explicitly provide the DOM id, then your mixin will end up with this id. However there are situations where you simply can't know the id before hand, and in such cases you must rely on Tapestry to provide it. A classic example is looping. If you have a loop that for some reason creates a variable number of components, to which you'd like to attach instances of your JS key logger, then you need to get the ids (created on the fly) from Tapestry. What's more, you can't assk a component for its id until it has already been assigned one, and the only way to be sure that your code executes after the assignment happen is to use Heartbeat#defer. Now as far as when a heartbeat is created, and when/who must call start() and end(), I'm not entirely sure. I think that a component whose behavior interacts with/depends on that of other components/mixins must use heartbeats to coordinate. I hope this helps. I'd suggest looking into the source for heartbeat's implementation as well as what really happens inside form support's defer method. You're not alone in your questions and expanded docs on this would be helpful. sincerely, chris PS - irc.freenode.net #tapestry Michael Courcy wrote: Gabriel Landais a écrit : Michael Courcy a écrit : If you look at this exemple : TreeGridComponent http://tapestry5-treegrid.googlecode.com/svn/trunk/tapestry5-treegrid/src/main/java/org/codelutin/tapestry/components/TreeGrid.java a hearbeat.begin is called in beginRender and heartbeat.end is called in afterRender but you can never read a call to defer, so can you explain why the author of this component call begin and end ? I really can't explain myself. I've based my component on http://wiki.apache.org/tapestry/Tapestry5HowToCreateYourOwnComponents and http://wiki.apache.org/tapestry/Tapestry5TreeComponent without really understanding how it heartbeat works... As I don't use defer, I don't even know if it is useful... Gabriel But do you see a different hehaviour if you remove this two lines ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's heartbeat ?
Your code Gabriel work as well without heartbeats ... ;-) Stephane Gabriel Landais a écrit : Michael Courcy a écrit : If you look at this exemple : TreeGridComponent http://tapestry5-treegrid.googlecode.com/svn/trunk/tapestry5-treegrid/src/main/java/org/codelutin/tapestry/components/TreeGrid.java a hearbeat.begin is called in beginRender and heartbeat.end is called in afterRender but you can never read a call to defer, so can you explain why the author of this component call begin and end ? I really can't explain myself. I've based my component on http://wiki.apache.org/tapestry/Tapestry5HowToCreateYourOwnComponents and http://wiki.apache.org/tapestry/Tapestry5TreeComponent without really understanding how it heartbeat works... As I don't use defer, I don't even know if it is useful... Gabriel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's heartbeat ?
Hi Chris, Chris Lewis a écrit : I'm not an expert on this, but I can offer you a real need for defer(). Suppose you have a mixin that attaches some trivial piece of JavaScript to components that use it; for example, a key logger. As far as the JS, what you need to do is register a few DOM event handlers on an element - probably onkeypress or onkeyup, etc. Let's suppose you wrote a class that creates such objects, and all you need to instantiate them is the DOM id of the element. In a simple case all you'd need to do is have your mixin include the javascript and provide a line (like support.addScript()) to instantiate the object in JS code - providing the component id, which I think you can get through something like ComponentResources. Now, if in your template code you have one component for which you explicitly provide the DOM id, then your mixin will end up with this id. However there are situations where you simply can't know the id before hand, and in such cases you must rely on Tapestry to provide it. A classic example is looping. If you have a loop that for some reason creates a variable number of components, to which you'd like to attach instances of your JS key logger, then you need to get the ids (created on the fly) from Tapestry. What's more, you can't assk a component for its id until it has already been assigned one, and the only way to be sure that your code executes after the assignment happen is to use Heartbeat#defer. Now as far as when a heartbeat is created, and when/who must call start() and end(), I'm not entirely sure. I think that a component whose behavior interacts with/depends on that of other components/mixins must use heartbeats to coordinate. I understand this concept my question is how can they cooperate, It would be really nice to have a live example involving the use of heartbeat to get Ids of only known at runtime component. The only example I could find about heartbeat is to defer the firing of an event : Taken from http://wiki.apache.org/tapestry/Tapestry5SubmitContextComponent Runnable sendNotification = new Runnable() { public void run() { _resources.triggerEvent(SELECTED_EVENT, new Object[] {context}, null); } }; // When not deferred, don't wait, fire the event now (actually, at the end of the current // heartbeat). This is most likely because the Submit is inside a Loop and some contextual // information will change if we defer. Another option might be to wait until the next // heartbeak? if (_defer) _formSupport.defer(sendNotification); else _heartbeat.defer(sendNotification); But If you read the rest of this exemple, _heartbeat.begin, _heartbeat.end are never called ... Who call them ? What means calling them ? I hope this helps. I'd suggest looking into the source for heartbeat's implementation as well as what really happens inside form support's defer method. You're not alone in your questions and expanded docs on this would be helpful. You're right I think a little dive in the source code would be refreshing :-) sincerely, chris PS - irc.freenode.net #tapestry Michael Courcy wrote: Gabriel Landais a écrit : Michael Courcy a écrit : If you look at this exemple : TreeGridComponent http://tapestry5-treegrid.googlecode.com/svn/trunk/tapestry5-treegrid/src/main/java/org/codelutin/tapestry/components/TreeGrid.java a hearbeat.begin is called in beginRender and heartbeat.end is called in afterRender but you can never read a call to defer, so can you explain why the author of this component call begin and end ? I really can't explain myself. I've based my component on http://wiki.apache.org/tapestry/Tapestry5HowToCreateYourOwnComponents and http://wiki.apache.org/tapestry/Tapestry5TreeComponent without really understanding how it heartbeat works... As I don't use defer, I don't even know if it is useful... Gabriel But do you see a different hehaviour if you remove this two lines ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Courcy http://courcy.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's heartbeat ?
Steph a écrit : Your code Gabriel work as well without heartbeats ... ;-) Stephane Yes it is ;) Until you use defer, it should be useless. And as I think that I'll not need it, I remove it heartbeat reference. Gabriel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's heartbeat ?
sorry for jumping in but consider a label-input scenario/exampel if you want to generate the for attribute for your label you dont know the id of the input field when the label is rendered before the field. therefore the label components defers its rendering using the heartbeat service. g, kirs Michael Courcy [EMAIL PROTECTED] 07.01.2008 16:17 Bitte antworten an Tapestry users users@tapestry.apache.org An Tapestry users users@tapestry.apache.org Kopie Thema Re: What's heartbeat ? Hi Chris, Chris Lewis a écrit : I'm not an expert on this, but I can offer you a real need for defer(). Suppose you have a mixin that attaches some trivial piece of JavaScript to components that use it; for example, a key logger. As far as the JS, what you need to do is register a few DOM event handlers on an element - probably onkeypress or onkeyup, etc. Let's suppose you wrote a class that creates such objects, and all you need to instantiate them is the DOM id of the element. In a simple case all you'd need to do is have your mixin include the javascript and provide a line (like support.addScript()) to instantiate the object in JS code - providing the component id, which I think you can get through something like ComponentResources. Now, if in your template code you have one component for which you explicitly provide the DOM id, then your mixin will end up with this id. However there are situations where you simply can't know the id before hand, and in such cases you must rely on Tapestry to provide it. A classic example is looping. If you have a loop that for some reason creates a variable number of components, to which you'd like to attach instances of your JS key logger, then you need to get the ids (created on the fly) from Tapestry. What's more, you can't assk a component for its id until it has already been assigned one, and the only way to be sure that your code executes after the assignment happen is to use Heartbeat#defer. Now as far as when a heartbeat is created, and when/who must call start() and end(), I'm not entirely sure. I think that a component whose behavior interacts with/depends on that of other components/mixins must use heartbeats to coordinate. I understand this concept my question is how can they cooperate, It would be really nice to have a live example involving the use of heartbeat to get Ids of only known at runtime component. The only example I could find about heartbeat is to defer the firing of an event : Taken from http://wiki.apache.org/tapestry/Tapestry5SubmitContextComponent Runnable sendNotification = new Runnable() { public void run() { _resources.triggerEvent(SELECTED_EVENT, new Object[] {context}, null); } }; // When not deferred, don't wait, fire the event now (actually, at the end of the current // heartbeat). This is most likely because the Submit is inside a Loop and some contextual // information will change if we defer. Another option might be to wait until the next // heartbeak? if (_defer) _formSupport.defer(sendNotification); else _heartbeat.defer(sendNotification); But If you read the rest of this exemple, _heartbeat.begin, _heartbeat.end are never called ... Who call them ? What means calling them ? I hope this helps. I'd suggest looking into the source for heartbeat's implementation as well as what really happens inside form support's defer method. You're not alone in your questions and expanded docs on this would be helpful. You're right I think a little dive in the source code would be refreshing :-) sincerely, chris PS - irc.freenode.net #tapestry Michael Courcy wrote: Gabriel Landais a écrit : Michael Courcy a écrit : If you look at this exemple : TreeGridComponent http://tapestry5-treegrid.googlecode.com/svn/trunk/tapestry5-treegrid/src/main/java/org/codelutin/tapestry/components/TreeGrid.java a hearbeat.begin is called in beginRender and heartbeat.end is called in afterRender but you can never read a call to defer, so can you explain why the author of this component call begin and end ? I really can't explain myself. I've based my component on http://wiki.apache.org/tapestry/Tapestry5HowToCreateYourOwnComponents and http://wiki.apache.org/tapestry/Tapestry5TreeComponent without really understanding how it heartbeat works... As I don't use defer, I don't even know if it is useful... Gabriel But do you see a different hehaviour if you remove this two lines ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail
Re: What's heartbeat ?
I think we're clear now on the use of defer for for this task. The common question now seems to be about who does/is supposed to call start() and end(). In my example (as well as yours in less detail) I don't talk about who starts/ends and why. I simply cover why defer is needed. I think any inputs on these questions would be generally helpful: 1) Can you use only Heartbeat#defer without start()ing or end()ing? 2) If so, who start()s and end()s it? 3) If not, who must start() and end() it? Kristian Marinkovic wrote: sorry for jumping in but consider a label-input scenario/exampel if you want to generate the for attribute for your label you dont know the id of the input field when the label is rendered before the field. therefore the label components defers its rendering using the heartbeat service. g, kirs Michael Courcy [EMAIL PROTECTED] 07.01.2008 16:17 Bitte antworten an Tapestry users users@tapestry.apache.org An Tapestry users users@tapestry.apache.org Kopie Thema Re: What's heartbeat ? Hi Chris, Chris Lewis a écrit : I'm not an expert on this, but I can offer you a real need for defer(). Suppose you have a mixin that attaches some trivial piece of JavaScript to components that use it; for example, a key logger. As far as the JS, what you need to do is register a few DOM event handlers on an element - probably onkeypress or onkeyup, etc. Let's suppose you wrote a class that creates such objects, and all you need to instantiate them is the DOM id of the element. In a simple case all you'd need to do is have your mixin include the javascript and provide a line (like support.addScript()) to instantiate the object in JS code - providing the component id, which I think you can get through something like ComponentResources. Now, if in your template code you have one component for which you explicitly provide the DOM id, then your mixin will end up with this id. However there are situations where you simply can't know the id before hand, and in such cases you must rely on Tapestry to provide it. A classic example is looping. If you have a loop that for some reason creates a variable number of components, to which you'd like to attach instances of your JS key logger, then you need to get the ids (created on the fly) from Tapestry. What's more, you can't assk a component for its id until it has already been assigned one, and the only way to be sure that your code executes after the assignment happen is to use Heartbeat#defer. Now as far as when a heartbeat is created, and when/who must call start() and end(), I'm not entirely sure. I think that a component whose behavior interacts with/depends on that of other components/mixins must use heartbeats to coordinate. I understand this concept my question is how can they cooperate, It would be really nice to have a live example involving the use of heartbeat to get Ids of only known at runtime component. The only example I could find about heartbeat is to defer the firing of an event : Taken from http://wiki.apache.org/tapestry/Tapestry5SubmitContextComponent Runnable sendNotification = new Runnable() { public void run() { _resources.triggerEvent(SELECTED_EVENT, new Object[] {context}, null); } }; // When not deferred, don't wait, fire the event now (actually, at the end of the current // heartbeat). This is most likely because the Submit is inside a Loop and some contextual // information will change if we defer. Another option might be to wait until the next // heartbeak? if (_defer) _formSupport.defer(sendNotification); else _heartbeat.defer(sendNotification); But If you read the rest of this exemple, _heartbeat.begin, _heartbeat.end are never called ... Who call them ? What means calling them ? I hope this helps. I'd suggest looking into the source for heartbeat's implementation as well as what really happens inside form support's defer method. You're not alone in your questions and expanded docs on this would be helpful. You're right I think a little dive in the source code would be refreshing :-) sincerely, chris PS - irc.freenode.net #tapestry Michael Courcy wrote: Gabriel Landais a écrit : Michael Courcy a écrit : If you look at this exemple : TreeGridComponent http://tapestry5-treegrid.googlecode.com/svn/trunk/tapestry5-treegrid/src/main/java/org/codelutin/tapestry/components/TreeGrid.java a hearbeat.begin is called in beginRender and heartbeat.end is called in afterRender but you can never read a call to defer, so can you explain why the author of this component call begin and end ? I really can't explain myself. I've based my component on http://wiki.apache.org/tapestry/Tapestry5HowToCreateYourOwnComponents and http
Re: What's heartbeat ?
One reason Michael Courcy wrote: Gabriel Landais a écrit : Michael Courcy a écrit : If you look at this exemple : TreeGridComponent http://tapestry5-treegrid.googlecode.com/svn/trunk/tapestry5-treegrid/src/main/java/org/codelutin/tapestry/components/TreeGrid.java a hearbeat.begin is called in beginRender and heartbeat.end is called in afterRender but you can never read a call to defer, so can you explain why the author of this component call begin and end ? I really can't explain myself. I've based my component on http://wiki.apache.org/tapestry/Tapestry5HowToCreateYourOwnComponents and http://wiki.apache.org/tapestry/Tapestry5TreeComponent without really understanding how it heartbeat works... As I don't use defer, I don't even know if it is useful... Gabriel But do you see a different hehaviour if you remove this two lines ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's heartbeat ?
The Field/Label example is pretty canonical, you don't know the order they will render in (the Label generally before the Field, in western languages). The Label knows the field but not vice-versa. You need the Field to render before you can fully render the Label. Thus we put off a portion of the render, making use of T5's DOM, to fill in the detail (the for attribute of the rendered label element) until we know both have rendered. On Jan 7, 2008 8:23 AM, Chris Lewis [EMAIL PROTECTED] wrote: I think we're clear now on the use of defer for for this task. The common question now seems to be about who does/is supposed to call start() and end(). In my example (as well as yours in less detail) I don't talk about who starts/ends and why. I simply cover why defer is needed. I think any inputs on these questions would be generally helpful: 1) Can you use only Heartbeat#defer without start()ing or end()ing? Yes 2) If so, who start()s and end()s it? An enclosing component, such as a Loop. Also, the page initialization logic starts a Heartbeat for the entire page. Heartbeats are allowed to nest. 3) If not, who must start() and end() it? Just whoever starts it must also end it. If you end up writing a kind of looping component, you should add a Heartbeat to it. I wonder if that could be encapsulated inside a Mixin? Kristian Marinkovic wrote: sorry for jumping in but consider a label-input scenario/exampel if you want to generate the for attribute for your label you dont know the id of the input field when the label is rendered before the field. therefore the label components defers its rendering using the heartbeat service. g, kirs Michael Courcy [EMAIL PROTECTED] 07.01.2008 16:17 Bitte antworten an Tapestry users users@tapestry.apache.org An Tapestry users users@tapestry.apache.org Kopie Thema Re: What's heartbeat ? Hi Chris, Chris Lewis a écrit : I'm not an expert on this, but I can offer you a real need for defer(). Suppose you have a mixin that attaches some trivial piece of JavaScript to components that use it; for example, a key logger. As far as the JS, what you need to do is register a few DOM event handlers on an element - probably onkeypress or onkeyup, etc. Let's suppose you wrote a class that creates such objects, and all you need to instantiate them is the DOM id of the element. In a simple case all you'd need to do is have your mixin include the javascript and provide a line (like support.addScript()) to instantiate the object in JS code - providing the component id, which I think you can get through something like ComponentResources. Now, if in your template code you have one component for which you explicitly provide the DOM id, then your mixin will end up with this id. However there are situations where you simply can't know the id before hand, and in such cases you must rely on Tapestry to provide it. A classic example is looping. If you have a loop that for some reason creates a variable number of components, to which you'd like to attach instances of your JS key logger, then you need to get the ids (created on the fly) from Tapestry. What's more, you can't assk a component for its id until it has already been assigned one, and the only way to be sure that your code executes after the assignment happen is to use Heartbeat#defer. Now as far as when a heartbeat is created, and when/who must call start() and end(), I'm not entirely sure. I think that a component whose behavior interacts with/depends on that of other components/mixins must use heartbeats to coordinate. I understand this concept my question is how can they cooperate, It would be really nice to have a live example involving the use of heartbeat to get Ids of only known at runtime component. The only example I could find about heartbeat is to defer the firing of an event : Taken from http://wiki.apache.org/tapestry/Tapestry5SubmitContextComponent Runnable sendNotification = new Runnable() { public void run() { _resources.triggerEvent(SELECTED_EVENT, new Object[] {context}, null); } }; // When not deferred, don't wait, fire the event now (actually, at the end of the current // heartbeat). This is most likely because the Submit is inside a Loop and some contextual // information will change if we defer. Another option might be to wait until the next // heartbeak? if (_defer) _formSupport.defer(sendNotification); else _heartbeat.defer(sendNotification); But If you read the rest of this exemple, _heartbeat.begin, _heartbeat.end are never called ... Who call them ? What means calling them ? I hope this helps. I'd suggest looking into the source