1.1.1 • Published 7 years ago

mobx-stores v1.1.1

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
7 years ago

MobX stores for ReactJS applications.

Requirements

For using these stores you need to have a ReactJS application with MobX package installed. All methods and properties will re-render your components if called in an @observable class.

Installation

> npm i mobx-stores

Stores

  1. DeviceStore
  2. LocalStore (>= 1.1.0)
  3. SessionStore

1. DeviceStore

DeviceStore is made for get information about user device: mobile or desktop.

NB: Create a new instance in order to use it as soon as your application start.

import { DeviceStore } from 'mobx-stores';
export const deviceStore = new DeviceStore();
PropertyReturn valueDescription
isMobilebooleanReturns true if the device is mobile.
isDesktopbooleanReturns true if the device is desktop.
isPortraitbooleanReturns true if the device is in portrait mode.
isLandscapebooleanReturns true if the device is in landscape mode.
isMobilePortraitbooleanReturns true if the device is mobile and in portrait mode.
isMobileLandscapebooleanReturns true if the device is mobile and in landscape mode.

Usage example:

if (deviceStore.isMobile) {
    // do some stuff..
}

2. LocalStore

LocalStore is made for set and get variables in the browser's local storage.

NB: Create a new instance in order to use it as soon as your application start.

import { LocalStore } from 'mobx-stores';
export const localStore = new LocalStore();
ActionReturn valueArgumentsDescription
setvoidkey (string), value(any)Set a pair { key: value }.
getstringkey (string)Returns the value of the corresponding key.

Usage example:

localStore.set('username', 'tillo-dev');
console.log(localStore.get('username'));

3. SessionStore

SessionStore is made for set and get variables in the browser's session storage.

NB: Create a new instance in order to use it as soon as your application start.

import { SessionStore } from 'mobx-stores';
export const sessionStore = new SessionStore();
ActionReturn valueArgumentsDescription
setvoidkey (string), value(any)Set a pair { key: value }.
getstringkey (string)Returns the value of the corresponding key.

Usage example:

sessionStore.set('username', 'tillo-dev');
console.log(sessionStore.get('username'));

4. New stores coming soon!...

1.1.1

7 years ago

1.1.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.9

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago