How to use the vuex.Store.prototype function in vuex

To help you get started, we’ve selected a few vuex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nikolay-govorov / logux-vuex / create-logux-store.js View on Github external
function originCommit (action, isNotObjectTypeAction) {
    if (action.type === 'logux/state') {
      self.replaceState(action.state)

      return
    }

    var commitArgs = arguments

    if (isNotObjectTypeAction) {
      commitArgs = [action.type].concat(action.options)
    }

    if (action.type in self._mutations) {
      Store.prototype.commit.apply(self, commitArgs)
    }
  }
github nikolay-govorov / logux-vuex / create-logux-store.js View on Github external
if (meta.added) saveHistory(meta)
    } else {
      replay(meta.id, replayIsSafe).then(function () {
        if (meta.reasons.indexOf('replay') !== -1) {
          client.log.changeMeta(meta.id, {
            reasons: meta.reasons.filter(function (i) {
              return i !== 'replay'
            })
          })
        }
      })
    }
  }
}

LoguxState.prototype = Object.create(Store.prototype)

LoguxState.prototype.constructor = LoguxState

function createLoguxState (config) {
  if (!config) config = {}

  var client = new CrossTabClient(config)

  return LoguxState.bind(null, client, {
    dispatchHistory: config.dispatchHistory || 1000,
    saveStateEvery: config.saveStateEvery || 50,
    onMissedHistory: config.onMissedHistory
  })
}

module.exports = createLoguxState