Last active
May 29, 2017 07:12
-
-
Save arqex/301260707b7ac2e8e679ce7c08d46b33 to your computer and use it in GitHub Desktop.
Freezer store sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Freezer from 'freezer-js'; | |
var freezer = new Freezer({ | |
me: {id: 44, name: 'Javi', hobbies:['football', 'poker']}, | |
status: 'READY', | |
users: { | |
12: {id: 12, name: 'Joe', hobbies:['cinema', 'basket']}, | |
16: {id: 16, name: 'Alice', hobbies:['basket', 'videogames']}, | |
31: {id: 31, name: 'Mike', hobbies:['football', 'videogames']} | |
}, | |
friends: [16, 36], | |
messages:{ | |
16: ['Hola amigo', 'Cómo estás'], | |
31: ['I feel like going out', 'Do you want to come?'] | |
} | |
}); | |
// Accessing to the app state | |
var globalState = freezer.get(); | |
// Read from the state the way you read from JS objects | |
console.log( globalState.users[12].name ); // 'Joe' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment