mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
added storage mode...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
771b9c9be3
commit
14d053d874
@ -25,10 +25,21 @@ var core = require('features/core')
|
|||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
// XXX move store to a separate module...
|
||||||
|
|
||||||
// XXX should we unify this with the save/load API
|
// XXX should we unify this with the save/load API
|
||||||
var StoreActions = actions.Actions({
|
var StoreActions = actions.Actions({
|
||||||
config: {
|
config: {
|
||||||
|
// Storage mode...
|
||||||
|
//
|
||||||
|
// This can be:
|
||||||
|
// 'read-only'
|
||||||
|
// 'read-write'
|
||||||
|
// null - ignore store
|
||||||
|
//
|
||||||
|
// NOTE: this only affects start/stop/timer event handling, manual
|
||||||
|
// call to .loadData(..) / .saveData(..) are not affected...
|
||||||
|
'store-mode': 'read-write',
|
||||||
},
|
},
|
||||||
|
|
||||||
// Store handler dict...
|
// Store handler dict...
|
||||||
@ -178,21 +189,26 @@ module.Store = core.ImageGridFeatures.Feature({
|
|||||||
handlers: [
|
handlers: [
|
||||||
['start.pre',
|
['start.pre',
|
||||||
function(){
|
function(){
|
||||||
this.requestReadyAnnounce()
|
if(this.config['store-mode'] != null){
|
||||||
this
|
this.requestReadyAnnounce()
|
||||||
.loadData()
|
this
|
||||||
.then(function(){
|
.loadData()
|
||||||
this.declareReady() }.bind(this)) }],
|
.then(function(){
|
||||||
|
this.declareReady() }.bind(this))
|
||||||
|
} }],
|
||||||
|
['stop',
|
||||||
|
function(){
|
||||||
|
this.config['store-mode'] == 'read-write' && this.saveData() }],
|
||||||
// XXX timer???
|
// XXX timer???
|
||||||
// XXX
|
// XXX
|
||||||
['stop',
|
|
||||||
function(){ this.saveData() }],
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
// XXX we should have a separate store config with settings of how to
|
||||||
|
// load the store... (???)
|
||||||
var StoreLocalStorageActions = actions.Actions({
|
var StoreLocalStorageActions = actions.Actions({
|
||||||
// XXX get root key from config...
|
// XXX get root key from config...
|
||||||
// ...this would require us to store the store config separately...
|
// ...this would require us to store the store config separately...
|
||||||
@ -266,7 +282,7 @@ module.StoreLocalStorage = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
/*********************************************************************/
|
||||||
|
|
||||||
var ConfigStoreActions = actions.Actions({
|
var ConfigStoreActions = actions.Actions({
|
||||||
config: {
|
config: {
|
||||||
@ -385,6 +401,7 @@ module.ConfigStore = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
// XXX sync fs store...
|
// XXX sync fs store...
|
||||||
// XXX get better tag...
|
// XXX get better tag...
|
||||||
|
// XXX where do we write???
|
||||||
if((store.fsJSONSync || {}).config){
|
if((store.fsJSONSync || {}).config){
|
||||||
// XXX
|
// XXX
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user