Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create an event handler that evaluates an expression when a package is loaded
ResourceFunction["CreatePackageEventHandler"][code,"context`"] creates an event handler that evaluates code when "context`" starts loading. | |
ResourceFunction["CreatePackageEventHandler"][code,"context`",After] creates an event handler that evaluates code when "context`" finishes loading. |
Print a message when a package is first loaded:
| In[1]:= |
| Out[1]= |
| In[2]:= |
Print a message when a package finishes loading:
| In[3]:= | ![]() |
| Out[3]= |
| In[4]:= |
Check to see what file is used to load a context:
| In[5]:= |
| Out[5]= |
| In[6]:= |
| Out[6]= |
Get timing for loading a package:
| In[7]:= | ![]() |
| Out[9]= |
An auto-loading context that is already loaded will no longer trigger the loading event:
| In[10]:= |
| Out[10]= |
| In[11]:= |
| Out[11]= |
Run in a new session instead:
| In[12]:= | ![]() |
| Out[12]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License