|
|
Line 224: |
Line 224: |
|
2016:10:18:07.94 : Event received by task: reset |
|
2016:10:18:07.94 : Event received by task: reset |
|
</pre> |
|
</pre> |
|
|
|
|
=={{header|Delphi}}== |
|
=={{header|Delphi}}== |
|
<lang Delphi>program Events; |
|
<lang Delphi>program Events; |
Line 535: |
Line 536: |
|
-> |
|
-> |
|
</pre> |
|
</pre> |
|
|
|
|
⚫ |
=={{header|JavaScript}}== |
|
⚫ |
An example using the [[wp:Yahoo!_UI_Library|YUI]] library: |
|
⚫ |
<lang javascript>YUI().use('event-custom', function(Y) { |
|
⚫ |
|
|
⚫ |
Y.on('my:event', function () { |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
// fire the event after one second: |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
An example simulating [[wp:Document_Object_Model|DOM]] events: |
|
⚫ |
<lang javascript>YUI().use('node-event-simulate', function(Y) { |
|
⚫ |
// add a click event handler to a DOM node with id "button": |
|
⚫ |
Y.one("#button").on("click", function (e) { |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
// simulate the click after one second: |
|
⚫ |
|
|
⚫ |
Y.one("#button").simulate("click"); |
|
⚫ |
|
|
⚫ |
|
|
|
|
|
|
=={{header|Julia}}== |
|
=={{header|Julia}}== |
Line 650: |
Line 675: |
|
WM_MOUSEWHEEL = 522 |
|
WM_MOUSEWHEEL = 522 |
|
mx.msg_listen([WM_COPYDATA, WM_MOUSEWHEEL], VOID, #msgReceived)</lang> |
|
mx.msg_listen([WM_COPYDATA, WM_MOUSEWHEEL], VOID, #msgReceived)</lang> |
|
|
|
⚫ |
=={{header|JavaScript}}== |
|
⚫ |
An example using the [[wp:Yahoo!_UI_Library|YUI]] library: |
|
⚫ |
<lang javascript>YUI().use('event-custom', function(Y) { |
|
⚫ |
|
|
⚫ |
Y.on('my:event', function () { |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
// fire the event after one second: |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
An example simulating [[wp:Document_Object_Model|DOM]] events: |
|
⚫ |
<lang javascript>YUI().use('node-event-simulate', function(Y) { |
|
⚫ |
// add a click event handler to a DOM node with id "button": |
|
⚫ |
Y.one("#button").on("click", function (e) { |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
// simulate the click after one second: |
|
⚫ |
|
|
⚫ |
Y.one("#button").simulate("click"); |
|
⚫ |
|
|
⚫ |
|
|
|
|
|
|
|
=={{header|Mathematica}}== |
|
=={{header|Mathematica}}== |
Line 881: |
Line 882: |
|
|
|
|
|
$quit->recv;</lang> |
|
$quit->recv;</lang> |
|
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
<lang perl6>note now, " program start"; |
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
note now, " event reset by task"; |
|
⚫ |
|
|
|
|
|
⚫ |
note now, " program sleeping"; |
|
⚫ |
|
|
⚫ |
note now, " program signaling event"; |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
<pre>Instant:1403880984.089974 program start |
|
⚫ |
Instant:1403880984.095400 program sleeping |
|
⚫ |
Instant:1403880984.095491 task start |
|
⚫ |
Instant:1403880985.099381 program signaling event |
|
⚫ |
Instant:1403880985.109395 event reset by task</pre> |
|
|
|
|
⚫ |
See also [[Handle_a_signal#Perl_6]] for an example of using Supplies to do reactive programming based on events (Unix signals in this case). |
|
|
|
|
|
|
=={{header|Phix}}== |
|
=={{header|Phix}}== |
Line 1,070: |
Line 1,046: |
|
(void (sync task)) ; wait for the task to be done before exiting |
|
(void (sync task)) ; wait for the task to be done before exiting |
|
</lang> |
|
</lang> |
|
|
|
|
⚫ |
|
|
|
(formerly Perl 6) |
|
⚫ |
|
|
⚫ |
<lang perl6>note now, " program start"; |
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
note now, " event reset by task"; |
|
⚫ |
|
|
|
|
|
⚫ |
note now, " program sleeping"; |
|
⚫ |
|
|
⚫ |
note now, " program signaling event"; |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
<pre>Instant:1403880984.089974 program start |
|
⚫ |
Instant:1403880984.095400 program sleeping |
|
⚫ |
Instant:1403880984.095491 task start |
|
⚫ |
Instant:1403880985.099381 program signaling event |
|
⚫ |
Instant:1403880985.109395 event reset by task</pre> |
|
|
|
|
⚫ |
See also [[Handle_a_signal#Perl_6]] for an example of using Supplies to do reactive programming based on events (Unix signals in this case). |
|
|
|
|
|
=={{header|REXX}}== |
|
=={{header|REXX}}== |