# Class: PopinController

## PopinController

#### new PopinController(userOptions)

  Create a controller tha manage all popin in the page

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `userOptions` | Object | Same options like the Popin class

  See:
    - extra/modules/popin.md for details.

  ##### Example

      let controller = new PopinController( popinOptions );
      popin.loadForm( $form );

### Methods

#### clear()

  Remove the content of the popin

  ##### Returns:

  Type
    Promise

#### close()

  Close the popin

  ##### Returns:

  Type
    Promise

#### destroy()

  Remove all events, css class or inline styles

#### load(url, data [, type])

  Load a file and display it in the popin

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `url` | String |  |  |
  `data` | Object |  |  | All parameters available for window.fetch
  `type` | String | <optional> | text |

  ##### Returns:

  Type
    Promise

#### loadForm($form)

  Send a form and display the result it in the popin

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `$form` | HTMLElement |

  ##### Returns:

  Type
    Promise

#### loadLink($link)

  Load a page from a link and display the result it in the popin

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `$link` | HTMLElement |

  ##### Returns:

  Type
    Promise

#### open()

  Open the popin

  ##### Returns:

  Type
    Promise

#### set(html, openFirst)

  Insert some html in the popin and open it

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `html` | String |
  `openFirst` | Boolean | Open the popin THEN insert the html

  ##### Returns:

  Type
    Promise

#### Search results