Last active
August 29, 2015 14:21
-
-
Save codepersononline/d3ae7da9564d4fa41bb8 to your computer and use it in GitHub Desktop.
Example - load and run a Module Pattern from a callback
This file contains hidden or 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
<# Author: Steve Rathbone | |
May 2015 | |
#> | |
$sb = { | |
[string]$myPrivateVariable = "Hello World!" | |
function Say-HelloWorld([string]$s) { | |
write-output $s | |
} | |
Say-HelloWorld $myPrivateVariable | |
} | |
function InvokeModulePatternFromCallback([scriptblock]$callback) { | |
& $callback | |
} | |
cls | |
InvokeModulePatternFromCallback $sb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment