Last active
August 29, 2015 14:20
-
-
Save normanzb/38ca5a08d10074ff2351 to your computer and use it in GitHub Desktop.
Get value from state object
This file contains 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
!function(){ | |
// make sure there is et object | |
window.et = window.et || {}; | |
// make sure there is et.state array | |
window.et.state = window.et.state || []; | |
var state = window.et.state; | |
// push a callback function into the array, once state object is instantiated, | |
// the callback will be called, and then you will be able to use those extended APIs | |
// such as get, put... etc... | |
state.push(null, function(){ | |
// call get() to get multiple values at once | |
state.get('user.market', 'user.something', 'user.somethingelse').then(function(values){ | |
console.log(values) | |
// do rest of the jobs here | |
}); | |
}) | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment