How to use grim - 10 common examples

To help you get started, we’ve selected a few grim 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 atom / atom / src / pane.js View on Github external
addItem (item, options = {}) {
    // Backward compat with old API:
    //   addItem(item, index=@getActiveItemIndex() + 1)
    if (typeof options === 'number') {
      Grim.deprecate(`Pane::addItem(item, ${options}) is deprecated in favor of Pane::addItem(item, {index: ${options}})`)
      options = {index: options}
    }

    const index = options.index != null ? options.index : this.getActiveItemIndex() + 1
    const moved = options.moved != null ? options.moved : false
    const pending = options.pending != null ? options.pending : false

    if (!item || typeof item !== 'object') {
      throw new Error(`Pane items must be objects. Attempted to add item ${item}.`)
    }

    if (typeof item.isDestroyed === 'function' && item.isDestroyed()) {
      throw new Error(`Adding a pane item with URI '${typeof item.getURI === 'function' && item.getURI()}' that has already been destroyed`)
    }

    if (this.items.includes(item)) return
github atom / atom / exports / ipc.js View on Github external
module.exports = require('electron').ipcRenderer;

const Grim = require('grim');
Grim.deprecate(
  'Use `require("electron").ipcRenderer` instead of `require("ipc")`'
);

// Ensure each package that requires this shim causes a deprecation warning
delete require.cache[__filename];
github steelbrain / atom-linter / src / index.js View on Github external
export function parse(
  data: string,
  regex: string,
  givenOptions: { flags?: string, filePath?: string } = {}
) {
  // TODO: Remove this in atom-linter v11.
  deprecate(
    "The `parse` method is deprecated and will be removed in the next major release of atom-linter."
  );
  if (typeof data !== "string") {
    throw new Error("Invalid or no `data` provided");
  } else if (typeof regex !== "string") {
    throw new Error("Invalid or no `regex` provided");
  } else if (typeof givenOptions !== "object") {
    throw new Error("Invalid or no `options` provided");
  }

  if (NamedRegexp === null) {
    /* eslint-disable global-require */
    NamedRegexp = require("named-js-regexp");
    /* eslint-enable global-require */
  }
github atom / metrics / lib / metrics.js View on Github external
// Reports initial deprecations as deprecations may have happened before metrics activation.
      setImmediate(() => {
        for (let deprecation of grim.getDeprecations()) {
          this.reportDeprecation(deprecation)
        }
      })
    })

    atom.packages.onDidLoadPackage(pack => {
      if (!this.packageVersionCache[pack.name]) {
        this.packageVersionCache[pack.name] = getPackageVersion(pack)
      }
    })

    grim.on('updated', deprecation => {
      setImmediate(() => this.reportDeprecation(deprecation))
    })
  },
github atom / atom / packages / deprecation-cop / lib / deprecation-cop-view.js View on Github external
constructor({ uri }) {
    this.uri = uri;
    this.subscriptions = new CompositeDisposable();
    this.subscriptions.add(
      Grim.on('updated', () => {
        etch.update(this);
      })
    );
    // TODO: Remove conditional when the new StyleManager deprecation APIs reach stable.
    if (atom.styles.onDidUpdateDeprecations) {
      this.subscriptions.add(
        atom.styles.onDidUpdateDeprecations(() => {
          etch.update(this);
        })
      );
    }
    etch.initialize(this);
    this.subscriptions.add(
      atom.commands.add(this.element, {
        'core:move-up': () => {
          this.scrollUp();
github nylas-mail-lives / nylas-mail / spec / spec-helper.es6 View on Github external
beforeEach(function() {
  NylasEnv.testOrganizationUnit = null;
  if (isCoreSpec) { Grim.clearDeprecations(); }
  ComponentRegistry._clear();
  global.localStorage.clear();

  DatabaseStore._transactionQueue = undefined;

  //# If we don't spy on DatabaseStore._query, then
  //`DatabaseStore.inTransaction` will never complete and cause all tests
  //that depend on transactions to hang.
  //
  // @_query("BEGIN IMMEDIATE TRANSACTION") never resolves because
  // DatabaseStore._query never runs because the @_open flag is always
  // false because we never setup the DB when `NylasEnv.inSpecMode` is
  // true.
  spyOn(DatabaseStore, '_query').andCallFake(() => Promise.resolve([]));

  TaskQueue._queue = [];
github atom / text-buffer / src / text-buffer.js View on Github external
loadSync (options) {
    if (!options || !options.internal) {
      Grim.deprecate('The .loadSync instance method is deprecated. Create a loaded buffer using TextBuffer.loadSync(filePath) instead.')
    }

    let patch = null
    let checkpoint = null
    try {
      patch = this.buffer.loadSync(
        this.getPath(),
        this.getEncoding(),
        (percentDone, patch) => {
          if (patch && patch.getChangeCount() > 0) {
            checkpoint = this.historyProvider.createCheckpoint({
              markers: this.createMarkerSnapshot(),
              isBarrier: true
            })
            this.emitter.emit('will-reload')
            this.emitWillChangeEvent()
github atom / atom / src / task-bootstrap.js View on Github external
return Grim.on('updated', function() {
    const deprecations = Grim.getDeprecations().map(deprecation =>
      deprecation.serialize()
    );
    Grim.clearDeprecations();
    return global.emit('task:deprecations', deprecations);
  });
};
github atom / atom / src / task-bootstrap.js View on Github external
const setupDeprecations = function() {
  const Grim = require('grim');
  return Grim.on('updated', function() {
    const deprecations = Grim.getDeprecations().map(deprecation =>
      deprecation.serialize()
    );
    Grim.clearDeprecations();
    return global.emit('task:deprecations', deprecations);
  });
};
github atom / atom / src / task-bootstrap.js View on Github external
return Grim.on('updated', function() {
    const deprecations = Grim.getDeprecations().map(deprecation =>
      deprecation.serialize()
    );
    Grim.clearDeprecations();
    return global.emit('task:deprecations', deprecations);
  });
};

grim

Log usage of deprecated methods

MIT
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis