     return model[klass.bindingsGetterMethodName()]()
 
 
-  @getPlatformStorageKey: _.memoize ->
-    # returns either "bindings-win" or "bindings-mac"
-
-    return "bindings-#{globals.keymapType}"
+  @getPlatformStorageKey: -> "#{STORAGE_NAME}-#{globals.keymapType}"


    { appManager, appStorageController } = kd.singletons

    @_store = appStorageController.storage 'Keyboard', STORAGE_VERSION

    # make sure we are not accessing storage until its ready.
    # this also updates kb bindings which are initially listening
    # for default combos.
    @_store.ready _.bind @handleStoreReady, this

    # add valid kb event listeners and invalidate obsolete upon
    # front application is set and ready
    appManager.on 'FrontAppChange',
      _.bind @handleFrontAppChange, this

    # save db whenever a shortcut is changed.
    # this should handled with some care to avoid exhausting
    # resources, since shortcuts emits all changes.
    @shortcuts.on 'change', (collection) =>
      @_save collection


  _save: _.throttle (collection) ->
    throw 'not ready'  unless @_isStoreReady

    data = collection.reduce (acc, model) ->
      acc[model.name] = klass.getPlatformBindings model
    , {}

    @_store.setValue klass.getPlatformStorageKey(), data

  , THROTTLE_WAIT,
    leading  : no
    trailing : yes


  _restore: ->
    throw 'not ready'  unless @_isStoreReady

    bindings = @_store.getValue(klass.getPlatformStorageKey()) or {}


  handleStoreReady: ->

    @_isStoreReady = yes

    @_restore()


  handleFrontAppChange: (app, prevApp) ->
    # invalidates previous app's keyboard events and adds new
    # listeners for the current one



  get: ->
    # proxy to shortcuts#get
    # see: http://github.com/koding/shortcuts#api

    @shortcuts.get.apply @shortcuts, Array::slice.call arguments


  update: ->
    # proxy to shortcuts#update
    # see: http://github.com/koding/shortcuts#api

    unless @_store.isReady
      console.warn 'changes won\'t be persisted, since storage is not ready yet'

    @shortcuts.update @shortcuts, Array::slice.call arguments

