How to use the fluxible/addons.createStore function in fluxible

To help you get started, we’ve selected a few fluxible 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 localnerve / react-pwa-reference / src / application / stores / ApplicationStore.js View on Github external
/***
 * Copyright (c) 2015, 2016 Alex Grant (@localnerve), LocalNerve LLC
 * Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
 */
import { createStore } from 'fluxible/addons';

const applicationStore = createStore({
  storeName: 'ApplicationStore',

  handlers: {
    'INIT_APP': 'initApplication',
    'UPDATE_PAGE_TITLE': 'updatePageTitle'
  },

  initialize: function () {
    this.currentPageTitle = '';
    this.defaultPageName = '';
  },

  /**
   * INIT_APP handler.
   * Initialize application data from payload.page.
   *
github localnerve / flux-react-example / stores / BackgroundStore.js View on Github external
/***
 * Copyright (c) 2015, 2016 Alex Grant (@localnerve), LocalNerve LLC
 * Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
 */
'use strict';
var createStore = require('fluxible/addons').createStore;
var debounce = require('lodash/debounce');
var buildImageUrl = require('../utils').buildImageUrl;

var BackgroundStore = createStore({
  storeName: 'BackgroundStore',

  handlers: {
    'UPDATE_SIZE': 'updateSize',
    'INIT_APP': 'initBackgrounds',
    'NAVIGATE_SUCCESS': 'updateBackground'
  },

  /**
   * Set initial store state.
   * Wire up debounced sizeChange handler.
   */
  initialize: function () {
    this.width = 0;
    this.height = 0;
    this.top = 0;
github localnerve / react-pwa-reference / src / application / stores / ContentStore.js View on Github external
/***
 * Copyright (c) 2016 - 2019 Alex Grant (@localnerve), LocalNerve LLC
 * Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
 */
import { createStore } from 'fluxible/addons';

export const ContentStore = createStore({
  storeName: 'ContentStore',

  handlers: {
    'INIT_APP': 'initContent',
    'RECEIVE_PAGE_CONTENT': 'receivePageContent'
  },

  /**
   * Set ContentStore initial state.
   */
  initialize: function () {
    this.contents = {};
    this.currentResource = '';
    this.defaultResource = '';
  },
github localnerve / react-pwa-reference / src / application / stores / SettingsStore.js View on Github external
/***
 * Copyright (c) 2016 - 2019 Alex Grant (@localnerve), LocalNerve LLC
 * Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
 *
 * Store for service settings.
 */
import { createStore } from 'fluxible/addons';

export const SettingsStore = createStore({
  storeName: 'SettingsStore',

  handlers: {
    'SETTINGS_STATE': 'updateSettingsState',
    'SETTINGS_TRANSITION': 'updateTransition'
  },

  /**
   * Set inital store state.
   */
  initialize: function () {
    this.hasServiceWorker = false;
    this.hasPushMessaging = false;
    this.hasPermissions = false;
    this.hasNotifications = false;
    this.pushBlocked = false;
github localnerve / react-pwa-reference / src / application / stores / ModalStore.js View on Github external
/***
 * Copyright (c) 2016 - 2019 Alex Grant (@localnerve), LocalNerve LLC
 * Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
 */
import { createStore } from 'fluxible/addons';

export const ModalStore = createStore({
  storeName: 'ModalStore',

  handlers: {
    'MODAL_START': 'modalStart',
    'RECEIVE_PAGE_CONTENT': 'updateProps',
    'MODAL_COMPONENT': 'updateComponent',
    'MODAL_FAILURE': 'modalFailure',
    'MODAL_STOP': 'modalStop'
  },

  /**
   * Set inital store state.
   */
  initialize: function () {
    this.isOpen = false;
    this.currentComponent = '';
github localnerve / react-pwa-reference / src / application / stores / ContactStore.js View on Github external
/***
 * Copyright (c) 2016 - 2019 Alex Grant (@localnerve), LocalNerve LLC
 * Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
 */
import { createStore } from 'fluxible/addons';

export const ContactStore = createStore({
  storeName: 'ContactStore',

  handlers: {
    'UPDATE_CONTACT_FIELDS': 'updateContactFields',
    'CREATE_CONTACT_SUCCESS': 'clearContactFields',
    'CREATE_CONTACT_FAILURE': 'setContactFailure'
  },

  /**
   * Set ContactStore initial state.
   */
  initialize: function () {
    this.name = '';
    this.email = '';
    this.message = '';
    this.failure = false;
github localnerve / flux-react-example / stores / ContentStore.js View on Github external
/***
 * Copyright (c) 2015, 2016 Alex Grant (@localnerve), LocalNerve LLC
 * Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
 */
'use strict';
var createStore = require('fluxible/addons').createStore;

var ContentStore = createStore({
  storeName: 'ContentStore',

  handlers: {
    'INIT_APP': 'initContent',
    'RECEIVE_PAGE_CONTENT': 'receivePageContent'
  },

  /**
   * Set ContentStore initial state.
   */
  initialize: function () {
    this.contents = {};
    this.currentResource = '';
    this.defaultResource = '';
  },
github localnerve / flux-react-example / stores / ApplicationStore.js View on Github external
/***
 * Copyright (c) 2015, 2016 Alex Grant (@localnerve), LocalNerve LLC
 * Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
 */
'use strict';
var createStore = require('fluxible/addons').createStore;

var ApplicationStore = createStore({
  storeName: 'ApplicationStore',

  handlers: {
    'INIT_APP': 'initApplication',
    'UPDATE_PAGE_TITLE': 'updatePageTitle'
  },

  /**
   * Set inital store state.
   */
  initialize: function () {
    this.currentPageTitle = '';
    this.defaultPageName = '';
  },

  /**
github localnerve / react-pwa-reference / src / application / stores / BackgroundStore.js View on Github external
/***
 * Copyright (c) 2016 - 2019 Alex Grant (@localnerve), LocalNerve LLC
 * Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
 */
import { createStore } from 'fluxible/addons';
import debounce from 'lodash/debounce';
import { buildImageUrl } from 'utils/imageServiceUrls';

export const BackgroundStore = createStore({
  storeName: 'BackgroundStore',

  handlers: {
    'UPDATE_SIZE': 'updateSize',
    'INIT_APP': 'initBackgrounds',
    'NAVIGATE_SUCCESS': 'updateBackground'
  },

  /**
   * Set initial store state.
   * Wire up debounced sizeChange handler.
   */
  initialize: function () {
    this.width = 0;
    this.height = 0;
    this.top = 0;
github localnerve / flux-react-example / stores / ContactStore.js View on Github external
/***
 * Copyright (c) 2015, 2016 Alex Grant (@localnerve), LocalNerve LLC
 * Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
 */
'use strict';
var createStore = require('fluxible/addons').createStore;

var ContactStore = createStore({
  storeName: 'ContactStore',

  handlers: {
    'UPDATE_CONTACT_FIELDS': 'updateContactFields',
    'CREATE_CONTACT_SUCCESS': 'clearContactFields',
    'CREATE_CONTACT_FAILURE': 'setContactFailure'
  },

  /**
   * Set ContactStore initial state.
   */
  initialize: function () {
    this.name = '';
    this.email = '';
    this.message = '';
    this.failure = false;