mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-23 23:54:13 +08:00
17 lines
479 B
CoffeeScript
17 lines
479 B
CoffeeScript
|
_ = require 'underscore'
|
||
|
Model = null
|
||
|
SerializableRegistry = require './serializable-registry'
|
||
|
|
||
|
class DatabaseObjectRegistry extends SerializableRegistry
|
||
|
|
||
|
classMap: -> return @_constructors
|
||
|
|
||
|
register: (constructor) ->
|
||
|
Model ?= require './flux/models/model'
|
||
|
if constructor?.prototype instanceof Model
|
||
|
super
|
||
|
else
|
||
|
throw new Error("You must register a Database Object class with this registry", constructor)
|
||
|
|
||
|
module.exports = new DatabaseObjectRegistry()
|