Download src/js/stores/GlobalStateStore.js from merve/git-101: direct link, hf CLI and curl.
- Browser
- Download file 1.53 kB
-
https://huggingface.co/spaces/merve/git-101/resolve/main/src/js/stores/GlobalStateStore.js
- Command line
-
hf download hf://spaces/merve/git-101/src/js/stores/GlobalStateStore.js
-
curl -L -o GlobalStateStore.js https://huggingface.co/spaces/merve/git-101/resolve/main/src/js/stores/GlobalStateStore.js
1.53 kB
| ; | |
| var AppConstants = require('../constants/AppConstants'); | |
| var AppDispatcher = require('../dispatcher/AppDispatcher'); | |
| var EventEmitter = require('events').EventEmitter; | |
| var ActionTypes = AppConstants.ActionTypes; | |
| var _isAnimating = false; | |
| var _flipTreeY = false; | |
| var _numLevelsSolved = 0; | |
| var _disableLevelInstructions = false; | |
| var GlobalStateStore = Object.assign( | |
| {}, | |
| EventEmitter.prototype, | |
| AppConstants.StoreSubscribePrototype, | |
| { | |
| getIsAnimating: function() { | |
| return _isAnimating; | |
| }, | |
| getFlipTreeY: function() { | |
| return _flipTreeY; | |
| }, | |
| getNumLevelsSolved: function() { | |
| return _numLevelsSolved; | |
| }, | |
| getShouldDisableLevelInstructions: function() { | |
| return _disableLevelInstructions; | |
| }, | |
| dispatchToken: AppDispatcher.register(function(payload) { | |
| var action = payload.action; | |
| var shouldInform = false; | |
| switch (action.type) { | |
| case ActionTypes.CHANGE_IS_ANIMATING: | |
| _isAnimating = action.isAnimating; | |
| shouldInform = true; | |
| break; | |
| case ActionTypes.CHANGE_FLIP_TREE_Y: | |
| _flipTreeY = action.flipTreeY; | |
| shouldInform = true; | |
| break; | |
| case ActionTypes.LEVEL_SOLVED: | |
| _numLevelsSolved++; | |
| shouldInform = true; | |
| break; | |
| case ActionTypes.DISABLE_LEVEL_INSTRUCTIONS: | |
| _disableLevelInstructions = true; | |
| shouldInform = true; | |
| break; | |
| } | |
| if (shouldInform) { | |
| GlobalStateStore.emit(AppConstants.CHANGE_EVENT); | |
| } | |
| }) | |
| }); | |
| module.exports = GlobalStateStore; | |