subscribeToOpenCodeFile

Beta
Beta

subscribeToOpenCodeFile

subscribeToOpenCodeFile

Subscribe to changes in the Code Editor’s active file.

const unsubscribe = framer.subscribeToOpenCodeFile((codeFile) => {
  console.log(`Currently open code file: ${codeFile.id}`);
});

// Later, stop listening
unsubscribe();

Mode

This function is available when the framer.mode is "code".

Parameters

  • callback: (codeFile: CodeFile) => void – Function called when active code file changes

Returns

  • Unsubscribe – Function to stop listening to changes