<!-- Do not edit this file. It is automatically generated by API Documenter. --> [`Workspace`](Workspace) › [on('file-open')](Workspace/on('file-open').md) ## Workspace.on('file-open') method **Signature:** ```typescript on(name: 'file-open', callback: (file: TFile | null) => any, ctx?: any): EventRef; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | <code>name</code> | <code>'file-open'</code> | | | <code>callback</code> | <code>(file: </code>[`TFile`](TFile)<code> &#124; null) =&gt; any</code> | | | <code>ctx</code> | <code>any</code> | _(Optional)_ | **Returns:** [`EventRef`](EventRef)