How to use the pathwatcher.File function in pathwatcher

To help you get started, we’ve selected a few pathwatcher examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyter / atom-notebook / lib / notebook-editor.js View on Github external
loadNotebookFile(uri) {
      // console.log('LOAD NOTEBOOK FILE');
      this.file = new File(uri);
      let parsedFile = this.parseNotebookFile(this.file);
      if (parsedFile.cells) {
        parsedFile.cells = parsedFile.cells.map(cell => {
          cell.metadata.id = uuid.v4();
          cell.metadata.focus = false;
          return cell;
        });
      } else {
        parsedFile.cells = [
         {
          cell_type: 'code',
          execution_count: null,
          metadata: {
           collapsed: true
          },
          outputs: [],
github nylas-mail-lives / nylas-mail / packages / client-app / spec / n1-spec-runner / master-before-each.es6 View on Github external
_resetNylasEnv() {
    NylasEnv.workspaceViewParentSelector = '#jasmine-content';

    // Don't actually write to disk
    spyOn(NylasEnv, 'saveSync');

    // prevent specs from modifying N1's menus
    spyOn(NylasEnv.menu, 'sendToBrowserProcess');

    FocusedPerspectiveStore._current = MailboxPerspective.forNothing();

    spyOn(pathwatcher.File.prototype, "detectResurrectionAfterDelay").andCallFake(function detectResurrection() {
      return this.detectResurrection();
    });
  }
github nylas-mail-lives / nylas-mail / spec / n1-spec-runner / master-before-each.es6 View on Github external
_resetNylasEnv() {
    NylasEnv.testOrganizationUnit = null;

    NylasEnv.workspaceViewParentSelector = '#jasmine-content';

    // Don't actually write to disk
    spyOn(NylasEnv, 'saveSync');

    // prevent specs from modifying N1's menus
    spyOn(NylasEnv.menu, 'sendToBrowserProcess');

    FocusedPerspectiveStore._current = MailboxPerspective.forNothing();

    spyOn(pathwatcher.File.prototype, "detectResurrectionAfterDelay").andCallFake(function detectResurrection() {
      return this.detectResurrection();
    });
  }
github atom / atom / src / theme-manager.js View on Github external
loadUserStylesheet() {
    this.unwatchUserStylesheet();

    const userStylesheetPath = this.styleManager.getUserStyleSheetPath();
    if (!fs.isFileSync(userStylesheetPath)) {
      return;
    }

    try {
      this.userStylesheetFile = new File(userStylesheetPath);
      this.userStylesheetSubscriptions = new CompositeDisposable();
      const reloadStylesheet = () => this.loadUserStylesheet();
      this.userStylesheetSubscriptions.add(
        this.userStylesheetFile.onDidChange(reloadStylesheet)
      );
      this.userStylesheetSubscriptions.add(
        this.userStylesheetFile.onDidRename(reloadStylesheet)
      );
      this.userStylesheetSubscriptions.add(
        this.userStylesheetFile.onDidDelete(reloadStylesheet)
      );
    } catch (error) {
      const message = `\
Unable to watch path: \`${path.basename(userStylesheetPath)}\`. Make sure
you have permissions to \`${userStylesheetPath}\`.
github nylas-mail-lives / nylas-mail / spec / spec-helper.es6 View on Github external
spyOn(Config.prototype, 'getRawValues').andCallFake(() => {
    return fakePersistedConfig;
  }
  );
  spyOn(Config.prototype, 'setRawValue').andCallFake(function(keyPath, value) {
    if (keyPath) {
      _.setValueForKeyPath(fakePersistedConfig, keyPath, value);
    } else {
      fakePersistedConfig = value;
    }
    return this.load();
  });
  NylasEnv.config = new Config();
  NylasEnv.loadConfig();

  spyOn(pathwatcher.File.prototype, "detectResurrectionAfterDelay").andCallFake(function() {
    return this.detectResurrection();
  });

  let clipboardContent = 'initial clipboard content';
  spyOn(clipboard, 'writeText').andCallFake(text => clipboardContent = text);
  spyOn(clipboard, 'readText').andCallFake(() => clipboardContent);

  advanceClock(1000);
  addCustomMatchers(this);

  return TimeOverride.resetSpyData();
});
github atom / text-buffer / src / text-buffer.js View on Github external
saveAs (filePath) {
    if (!filePath) throw new Error("Can't save buffer with no file path")
    return this.saveTo(new File(filePath))
  }
github atom / text-buffer / src / text-buffer.js View on Github external
setPath (filePath) {
    if (filePath === this.getPath()) return
    return this.setFile(filePath && new File(filePath))
  }

pathwatcher

Watch files and directories for changes

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages