Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ClassLoader and Event documentation complete.
- Loading branch information
1 parent
3bda740
commit d1eec84
Showing
4 changed files
with
108 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php include "lib/Recess/Recess.php"; use Recess\Core\Event; | ||
|
||
// ==== One Callback, With No Arguments | ||
$onLoad = new Event(); | ||
$onLoad->callback(function() { echo "Event triggered!\n"; }); | ||
echo 'Calling onLoad...'; | ||
$onLoad(); | ||
//> Calling onLoad... Event triggered! | ||
|
||
// ==== Many Callbacks | ||
$onLoad = new Event(); | ||
$onLoad->callback(function() { echo "First callback. "; }) | ||
->callback(function() { echo "Second callback.\n"; }); | ||
$onLoad(); | ||
//> First callback. Second callback. | ||
|
||
// ==== Passing Arguments | ||
$onSaveFile = new Event(); | ||
$onSaveFile->callback(function($file) { echo "Saving $file!\n"; }); | ||
$onSaveFile('example.txt'); | ||
//> Saving example.txt! |