Skip to content

types #3

@jonschlinkert

Description

@jonschlinkert

Background

Currently, in templates, assemble and other base app, we have the convention of using isApp, isView and so on to identify the "instance type", so that plugins will only be used on certain instances.

Proposal

I propose that we implement one or two methods and associated properties here, in base-plugins, for checking instance "types". I think these methods belong here since "smart plugins" can't be used without this plugin, thus isApp or similar labels are useless otherwise.

Example

  • .is {Function}: Currently we use the .is method to add a type to an instance. I think this can stay the same, but we can also allow an array of strings to be passed, like app.is(['views', 'collection'])
  • ._is {Array}: we should add an ._is array for storing names passed to .is.
  • .isType {Function}: this method would take a string or array of strings and return true if an instance has any of the given strings on the ._is array. It would also return true for isType('app') when no other types are defined.

@doowb, anyone else, thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions