Skip to content

Decide on additionalMethods format #1

Description

@vweevers

Initially we can do:

{
  additionalMethods: {
    approximateSize: true
  }
}

Which is enough to start using that in deferred-leveldown (Level/deferred-leveldown#35) and level-packager levelup. @ralphtheninja WDYT?

Later we can add function signature info. I propose to stick with boolean properties, so that we can describe multiple signatures (e.g. callbacks and promises):

{
  additionalMethods: {
    approximateSize: {
      sync: false,
      callback: true,
      promise: false
    }
  }
}

With that in place, a db wrapper could do things like:

wrapper.prototype.approximateSize = function (..) {
  if (this.db.supports.additionalMethods.approximateSize.promise) {
    return db.approximateSize(..)
  } else {
    // Wrap in promise
  }
}

Even later, we can add a return type to the manifest. Mainly for streams. Not sure what that should look like. Perhaps:

{
  additionalMethods: {
    createWriteStream: {
      sync: false,
      writable: true
    }
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions