# Class: base

## base

The base of all classes in the system, this is one of the few pure "classes" in core the of the system. It is a pretty clean little class whose primary purpose is to surface the composition chains and a basis for storing options on mixin and subclass instances. Options are handled at the instance rather than the prototype level so that multiple instances don't compete for default values.

#### new base()

  Source:
    - base/index.js, line 22

### Extends

- base/chains

### Members

#### close

  The `close` method asks an object to shut itself down in a way that will allow it to be reopened, unlike the end method which will call the destroy method which should make the object unusable, but also devoid of all resources whereas `close` may still keep some resources open.

  This uses the `before` chain which means the last one defined in the first one destroyed

  Inherited From:
    - base/chains#close
  Source:
    - base/chains.js, line 15
  See:
    - base/chains#open

#### open

  If you are using the open/close paradigm for an object that can kind of go dormant on base/chains#close and can be "reopened" again later, here is where the "open" code will go.

  This used the `after` chain which means that the first one defined is the first one destroyed.

  Inherited From:
    - base/chains#open
  Source:
    - base/chains.js, line 49
  See:
    - base/chains#close

### Methods

#### addDefaultOptions(options)

  Add a default option to a class. The default options are only set if there is not already a value for the option.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | hash | A hash of options you want to set

  Source:
    - base/index.js, line 40
  See:
    - {base#addOptions}

#### addOptions(options)

  Add an option to a class. If any members of the hash already exist in `this.options`, they will be overwritten.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | hash | A hash of options you want to set

  Source:
    - base/index.js, line 29
  See:
    - {base#addDefaultOptions}

#### destroy()

  Called when it is time to get rid of all of your instance level references and objects and events. You can define this method on your own classes without having to call the superclass instance. It is called by `instance.end()` automatically

  Source:
    - base/index.js, line 64
  See:
    - {base/chains#end}
    - {base/chains#destroy}

#### end()

  Call this to close your object and dispose of all maintained resources. You can define this method on your own classes without having to call the superclass instance, however it is reccomended that you put all disposal code in `destroy()`. You must be disciplined about calling this on your instances.

  Source:
    - base/index.js, line 53
  See:
    - {base/chains#end}
    - {base/chains#destroy}