{"size": 643, "ext": "js", "max_stars_repo_path": "widgets/base_widget.js", "max_stars_repo_name": "mainfoxop/digital-signage", "max_stars_repo_stars_event_min_datetime": "2019-05-15T20:43:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-26T13:45:20.000Z", "max_issues_repo_path": "widgets/base_widget.js", "max_issues_repo_name": "Eun/digital-signage", "max_issues_repo_issues_event_min_datetime": "2019-02-22T20:34:51.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-12T20:16:04.000Z", "max_forks_repo_path": "widgets/base_widget.js", "max_forks_repo_name": "Eun/digital-signage", "max_forks_repo_forks_event_min_datetime": "2019-06-16T16:50:23.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T20:16:35.000Z"}
{"max_stars_count": 68, "max_issues_count": 38, "max_forks_count": 47, "avg_line_length": 24.7307692308, "max_line_length": 77, "alphanum_fraction": 0.6827371695}
import EmptyWidget from '../components/Widgets/EmptyWidget'
import EmptyWidgetOptions from '../components/Widgets/EmptyWidgetOptions'

const REQUIRED_DEF_FIELDS = ['name', 'version', 'icon']

export default class BaseWidget {
  constructor(definition) {
    for (const reqField of REQUIRED_DEF_FIELDS) {
      if (!(reqField in definition)) {
        throw new Error(`${reqField} is a required property of new widgets.`)
      }
    }
    for (const defField of Object.keys(definition)) {
      this[defField] = definition[defField]
    }
  }

  get Widget() {
    return EmptyWidget
  }

  get Options() {
    return EmptyWidgetOptions
  }
}
