Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@swdotcom/editor-flow

Package Overview
Dependencies
Maintainers
7
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swdotcom/editor-flow

Editor change event handler

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
7
Created
Source

editor-flow

Handles document change events

Install

yarn add editor-flow

Usage

import { EditorFlow, EditorType, FlowEventType, ProjectChangeInfo, VSCodeInterface } from 'editor-flow';

const iface: VSCodeInterface = {
  disposable: Disposable,  // vscode disposable
  window: window,          // vscode window namespace
  workspace: workspace     // vscode workspace namespace
};

const editorFlow:EditorFlow = EditorFlow.getInstance(EditorType.VSCODE, iface);
const emitter: any = editorFlow.getEmitter();

emitter.on('editor_flow_data', (data: any) => {
  switch(data.flow_event_type) {
    case FlowEventType.CLOSE:
      this.fileCloseHandler(data.event);
      break;
    case FlowEventType.OPEN:
      this.fileOpenHandler(data.event);
      break;
    case FlowEventType.SAVE:
      this.fileSaveHandler(data.event);
      break;
    case FlowEventType.UNFOCUS:
      this.windowStateChangeHandler(data.event);
      break;
    case FlowEventType.FOCUS:
      this.windowStateChangeHandler(data.event);
      break;
    case FlowEventType.THEME:
      this.themeKindChangeHandler(data.event);
      break;
    case FlowEventType.KPM:
      // get the project_change_info attribute and post it
      this.kpmHandler(data.project_change_info);
      break;
  }
});

...

private kpmHandler(
  projectChangeInfo: ProjectChangeInfo) {
  this.tracker.trackCodeTimeEvent(projectChangeInfo);
}

Keywords

FAQs

Package last updated on 17 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc