Skip to content

Commit

Permalink
Move defer to different namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher committed Sep 20, 2024
1 parent a48ecbc commit 97c0b2a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/mantle/queue/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,3 @@ function dispatch( $job ): Pending_Dispatch|Pending_Closure_Dispatch {
: new Pending_Dispatch( $job );
}
}

if ( ! function_exists( __NAMESPACE__ . '\defer' ) ) {
/**
* Defer the execution of a function until after the response is sent to the page.
*
* @param callable $callback Callback to defer.
*/
function defer( callable $callback ): void {
app()->terminating( $callback );
}
}
11 changes: 11 additions & 0 deletions src/mantle/support/helpers/helpers-general.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,3 +531,14 @@ function validate_file( $file, $allowed_files = [] ) {
// Absolute Windows drive paths ARE allowed.
return 0;
}

if ( ! function_exists( __NAMESPACE__ . '\defer' ) ) {
/**
* Defer the execution of a function until after the response is sent to the page.
*
* @param callable $callback Callback to defer.
*/
function defer( callable $callback ): void {
app()->terminating( $callback );
}
}

0 comments on commit 97c0b2a

Please sign in to comment.