Skip to content

Instantly share code, notes, and snippets.

@codepersononline
Last active August 29, 2015 14:21
Show Gist options
  • Save codepersononline/d3ae7da9564d4fa41bb8 to your computer and use it in GitHub Desktop.
Save codepersononline/d3ae7da9564d4fa41bb8 to your computer and use it in GitHub Desktop.
Example - load and run a Module Pattern from a callback
<# 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