Skip to content

Instantly share code, notes, and snippets.

@potatoqualitee
Created April 11, 2021 00:00
Show Gist options
  • Save potatoqualitee/6949f6203cd8052308fc708045bab37a to your computer and use it in GitHub Desktop.
Save potatoqualitee/6949f6203cd8052308fc708045bab37a to your computer and use it in GitHub Desktop.
$MyScript = [powershell]::Create()
$null = $MyScript.AddScript( { Import-Module -Name Terminal-Icons } )
$Runspace = [runspacefactory]::CreateRunspace()
$MyScript.Runspace = $Runspace
$null = Register-ObjectEvent -InputObject $MyScript -EventName InvocationStateChanged -Action {
Import-Module -Name Terminal-Icons
}
@sassdawe
Copy link

sassdawe commented Mar 7, 2022

Can you help me understand what is happening here? Or even better, why? Thanks!

@potatoqualitee
Copy link
Author

hey David, we were trying to figure out how to load Terminal Icons a bit faster so that it wouldn't delay the loading of our profiles. I ended up going with the second code block, I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment