/
githubmirror
/
atom
Обзор
Документация
Войти
/
githubmirror
/
atom
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v1.51.0
src/model.coffee
23 строки
407 B
Nathan Sobo
Remove property-accessors dependency
22 сен 2015, 19:37
22 сен 2015, 19:37
69833af
Код
Авторство
О чём код?
nextInstanceId = 1 module.exports = class Model @resetNextInstanceId: -> nextInstanceId = 1 alive: true constructor: (params) -> @assignId(params?.id) assignId: (id) -> @id ?= id ? nextInstanceId++ nextInstanceId = id + 1 if id >= nextInstanceId destroy: -> return unless @isAlive() @alive = false @destroyed?() isAlive: -> @alive isDestroyed: -> not @isAlive()