/**
 * Mixin to handle side (client/server).
 * @mixin ApSideMixin
 */

'use strict'

import React, {PropTypes as types} from 'react'

/** @lends ApSideMixin */
let ApSideMixin = {

  // --------------------
  // Custom
  // --------------------
  $apSideMixed: true,

  /**
   * Check if server side or not.
   * @returns {boolean}
   */
  isSeverSide() {
    const s = this
    return !s.isClientSide()
  },

  /**
   * Check if client side or not.
   * @returns {boolean}
   */
  isClientSide () {
    const s = this
    return (typeof window !== 'undefined') && !!window && !!window.location;
  }

  // --------------------
  // Specs
  // --------------------

}

export default Object.freeze(ApSideMixin)
