mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-28 17:40:07 +00:00
working on browser...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
246392f888
commit
7ce3e6f8bc
8
Makefile
8
Makefile
@ -13,8 +13,14 @@ LOCAL_MODULES := \
|
|||||||
node_modules/ig-actions/actions.js \
|
node_modules/ig-actions/actions.js \
|
||||||
node_modules/ig-features/features.js
|
node_modules/ig-features/features.js
|
||||||
|
|
||||||
|
POUCH_DB := \
|
||||||
|
$(wildcard node_modules/pouchdb/dist/*)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ext-lib/pouchdb.js: node_modules $(POUCH_DB)
|
||||||
|
cp $(POUCH_DB) ext-lib/
|
||||||
|
|
||||||
bootstrap.js: scripts/bootstrap.js $(BOOTSTRAP_FILES)
|
bootstrap.js: scripts/bootstrap.js $(BOOTSTRAP_FILES)
|
||||||
node $<
|
node $<
|
||||||
|
|
||||||
@ -28,7 +34,7 @@ node_modules:
|
|||||||
npm install
|
npm install
|
||||||
|
|
||||||
|
|
||||||
dev: node_modules $(LOCAL_MODULES) bootstrap
|
dev: node_modules ext-lib/pouchdb.js $(LOCAL_MODULES) bootstrap
|
||||||
cp $(LOCAL_MODULES) lib/
|
cp $(LOCAL_MODULES) lib/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
35
browser.js
35
browser.js
@ -11,17 +11,48 @@ var object = require('ig-object')
|
|||||||
var types = require('ig-types')
|
var types = require('ig-types')
|
||||||
|
|
||||||
var pwpath = require('./lib/path')
|
var pwpath = require('./lib/path')
|
||||||
|
var page = require('./page')
|
||||||
|
|
||||||
var basestore = require('./store/base')
|
var basestore = require('./store/base')
|
||||||
var localstoragestore = require('./store/localstorage')
|
var localstoragestore = require('./store/localstorage')
|
||||||
|
|
||||||
// XXX for some reason this does not run quietly in browser
|
var pouchdbstore = require('./store/pouchdb')
|
||||||
//var pouchdbstore = require('./store/pouchdb')
|
|
||||||
|
|
||||||
// XXX this fails silently in browser...
|
// XXX this fails silently in browser...
|
||||||
//var bootstrap = require('./bootstrap')
|
//var bootstrap = require('./bootstrap')
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
var store =
|
||||||
|
module.store =
|
||||||
|
{ __proto__: basestore.BaseStore }
|
||||||
|
.nest({ __proto__: basestore.MetaStore })
|
||||||
|
|
||||||
|
store.update('System',
|
||||||
|
Object.create(basestore.BaseStore).load(page.System))
|
||||||
|
|
||||||
|
var pwiki =
|
||||||
|
module.pwiki =
|
||||||
|
page.Page('/', '/', store)
|
||||||
|
|
||||||
|
|
||||||
|
pwiki.store.update('@local', {
|
||||||
|
__proto__: localstoragestore.localStorageStore,
|
||||||
|
data: localStorage,
|
||||||
|
})
|
||||||
|
|
||||||
|
pwiki.store.update('@session', {
|
||||||
|
__proto__: localstoragestore.localStorageStore,
|
||||||
|
data: sessionStorage,
|
||||||
|
})
|
||||||
|
|
||||||
|
pwiki.store.update('@pouch', {
|
||||||
|
__proto__: pouchdbstore.PouchDBStore,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* vim:set ts=4 sw=4 : */ return module })
|
* vim:set ts=4 sw=4 : */ return module })
|
||||||
|
|||||||
1
ext-lib/README
Executable file
1
ext-lib/README
Executable file
@ -0,0 +1 @@
|
|||||||
|
This directory contains external modules used for in-browser rendering.
|
||||||
6798
ext-lib/pouchdb.find.js
Executable file
6798
ext-lib/pouchdb.find.js
Executable file
File diff suppressed because it is too large
Load Diff
8
ext-lib/pouchdb.find.min.js
vendored
Executable file
8
ext-lib/pouchdb.find.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
5152
ext-lib/pouchdb.indexeddb.js
Executable file
5152
ext-lib/pouchdb.indexeddb.js
Executable file
File diff suppressed because it is too large
Load Diff
2
ext-lib/pouchdb.indexeddb.min.js
vendored
Executable file
2
ext-lib/pouchdb.indexeddb.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
13146
ext-lib/pouchdb.js
Executable file
13146
ext-lib/pouchdb.js
Executable file
File diff suppressed because it is too large
Load Diff
21765
ext-lib/pouchdb.localstorage.js
Executable file
21765
ext-lib/pouchdb.localstorage.js
Executable file
File diff suppressed because it is too large
Load Diff
45
ext-lib/pouchdb.localstorage.min.js
vendored
Executable file
45
ext-lib/pouchdb.localstorage.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
22008
ext-lib/pouchdb.memory.js
Executable file
22008
ext-lib/pouchdb.memory.js
Executable file
File diff suppressed because it is too large
Load Diff
45
ext-lib/pouchdb.memory.min.js
vendored
Executable file
45
ext-lib/pouchdb.memory.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
10
ext-lib/pouchdb.min.js
vendored
10
ext-lib/pouchdb.min.js
vendored
File diff suppressed because one or more lines are too long
46
filters/base.js
Executable file
46
filters/base.js
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
**********************************************************************/
|
||||||
|
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
|
||||||
|
(function(require){ var module={} // make module AMD/node compatible...
|
||||||
|
/*********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// XXX revise...
|
||||||
|
var Filter =
|
||||||
|
module.Filter =
|
||||||
|
function(...args){
|
||||||
|
var func = args.pop()
|
||||||
|
args.length > 0
|
||||||
|
&& Object.assign(func, args.pop())
|
||||||
|
return func }
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
var WIKIWORD_PATTERN =
|
||||||
|
RegExp('('+[
|
||||||
|
//'\\\\?(\\/|\\./|\\.\\./|>>|[A-Z][_a-z0-9]+[A-Z/])[_a-zA-Z0-9/]*',
|
||||||
|
'\\\\?\\/?(\\./|\\.\\./|>>|[A-Z][_a-z0-9]+[A-Z/])[_a-zA-Z0-9/]*',
|
||||||
|
'\\\\?\\[[^\\]]+\\]',
|
||||||
|
].join('|') +')', 'g')
|
||||||
|
|
||||||
|
module.wikiWord =
|
||||||
|
Filter(
|
||||||
|
{quote: 'quote-wikiword'},
|
||||||
|
function(source){
|
||||||
|
// XXX
|
||||||
|
return source })
|
||||||
|
module.quoteWikiWord =
|
||||||
|
function(source){
|
||||||
|
// XXX
|
||||||
|
return source }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* vim:set ts=4 sw=4 : */ return module })
|
||||||
31
filters/markdown.js
Executable file
31
filters/markdown.js
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
**********************************************************************/
|
||||||
|
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
|
||||||
|
(function(require){ var module={} // make module AMD/node compatible...
|
||||||
|
/*********************************************************************/
|
||||||
|
|
||||||
|
var base = require('./base')
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
module.markdown =
|
||||||
|
base.Filter(
|
||||||
|
{quote: 'quote-markdown'},
|
||||||
|
function(source){
|
||||||
|
// XXX
|
||||||
|
return source })
|
||||||
|
|
||||||
|
module.quoteMarkdown =
|
||||||
|
function(source){
|
||||||
|
// XXX
|
||||||
|
return source }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* vim:set ts=4 sw=4 : */ return module })
|
||||||
115
page.js
115
page.js
@ -14,13 +14,8 @@ var types = require('ig-types')
|
|||||||
|
|
||||||
var pwpath = require('./lib/path')
|
var pwpath = require('./lib/path')
|
||||||
var parser = require('./parser')
|
var parser = require('./parser')
|
||||||
|
var filters = require('./filters/base')
|
||||||
var basestore = require('./store/base')
|
var markdown = require('./filters/markdown')
|
||||||
|
|
||||||
//var localstoragestore = require('./store/localstorage')
|
|
||||||
// XXX for some reason this does not run quietly in browser
|
|
||||||
//var pouchdbstore = require('./store/pouchdb')
|
|
||||||
//var filestore = require('./store/file')
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
@ -46,6 +41,9 @@ function(name){
|
|||||||
Object.defineProperty(func, 'name', {value: name})
|
Object.defineProperty(func, 'name', {value: name})
|
||||||
return func }
|
return func }
|
||||||
|
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
var __HANDLE_NAVIGATE =
|
var __HANDLE_NAVIGATE =
|
||||||
module.__HANDLE_NAVIGATE =
|
module.__HANDLE_NAVIGATE =
|
||||||
types.event.EventCommand('HANDLE_NAVIGATE')
|
types.event.EventCommand('HANDLE_NAVIGATE')
|
||||||
@ -459,17 +457,9 @@ types.event.EventMixin(BasePage.prototype)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
//---------------------------------------------------------------------
|
||||||
// XXX should these be something more generic like Object.assign(..) ???
|
|
||||||
|
|
||||||
// XXX revise...
|
// XXX should these be something more generic like Object.assign(..) ???
|
||||||
var Filter =
|
|
||||||
module.Filter =
|
|
||||||
function(...args){
|
|
||||||
var func = args.pop()
|
|
||||||
args.length > 0
|
|
||||||
&& Object.assign(func, args.pop())
|
|
||||||
return func }
|
|
||||||
|
|
||||||
// XXX do we need anything else like .doc, attrs???
|
// XXX do we need anything else like .doc, attrs???
|
||||||
var Macro =
|
var Macro =
|
||||||
@ -531,23 +521,11 @@ object.Constructor('Page', BasePage, {
|
|||||||
return source
|
return source
|
||||||
.replace(/test/g, 'TEST') },
|
.replace(/test/g, 'TEST') },
|
||||||
|
|
||||||
wikiword: Filter(
|
wikiword: filters.wikiWord,
|
||||||
{quote: 'quote-wikiword'},
|
'quote-wikiword': filters.quoteWikiWord,
|
||||||
function(source){
|
|
||||||
// XXX
|
|
||||||
return source }),
|
|
||||||
'quote-wikiword': function(source){
|
|
||||||
// XXX
|
|
||||||
return source },
|
|
||||||
|
|
||||||
markdown: Filter(
|
markdown: markdown.markdown,
|
||||||
{quote: 'quote-markdown'},
|
'quote-markdown': markdown.quoteMarkdown,
|
||||||
function(source){
|
|
||||||
// XXX
|
|
||||||
return source }),
|
|
||||||
'quote-markdown': function(source){
|
|
||||||
// XXX
|
|
||||||
return source },
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1070,14 +1048,73 @@ object.Constructor('Page', BasePage, {
|
|||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
// System pages/actions...
|
||||||
|
|
||||||
var WIKIWORD_PATTERN =
|
var System =
|
||||||
RegExp('('+[
|
module.System = {
|
||||||
//'\\\\?(\\/|\\./|\\.\\./|>>|[A-Z][_a-z0-9]+[A-Z/])[_a-zA-Z0-9/]*',
|
// base templates...
|
||||||
'\\\\?\\/?(\\./|\\.\\./|>>|[A-Z][_a-z0-9]+[A-Z/])[_a-zA-Z0-9/]*',
|
//
|
||||||
'\\\\?\\[[^\\]]+\\]',
|
_text: {
|
||||||
].join('|') +')', 'g')
|
text: '<macro src="." join="\n">@source(.)</macro>' },
|
||||||
|
NotFound: {
|
||||||
|
text: module.PAGE_NOT_FOUND
|
||||||
|
.replace('$PATH', '@source(./path)') },
|
||||||
|
|
||||||
|
// XXX tests...
|
||||||
|
test_list: function(){
|
||||||
|
return 'abcdef'.split('') },
|
||||||
|
|
||||||
|
// metadata...
|
||||||
|
//
|
||||||
|
path: function(){
|
||||||
|
return this.get('..').path },
|
||||||
|
location: function(){
|
||||||
|
return this.get('..').path },
|
||||||
|
dir: function(){
|
||||||
|
return this.get('..').dir },
|
||||||
|
name: function(){
|
||||||
|
return this.get('..').name },
|
||||||
|
ctime: function(){
|
||||||
|
return this.get('..').data.ctime },
|
||||||
|
mtime: function(){
|
||||||
|
return this.get('..').data.mtime },
|
||||||
|
|
||||||
|
// XXX this can be a list for pattern paths...
|
||||||
|
resolved: function(){
|
||||||
|
return this.get('..').resolve() },
|
||||||
|
|
||||||
|
title: function(){
|
||||||
|
var p = this.get('..')
|
||||||
|
return p.title
|
||||||
|
?? p.name },
|
||||||
|
|
||||||
|
|
||||||
|
// utils...
|
||||||
|
//
|
||||||
|
// XXX System/subpaths
|
||||||
|
// XXX
|
||||||
|
links: function(){
|
||||||
|
// XXX
|
||||||
|
return '' },
|
||||||
|
// XXX links to pages...
|
||||||
|
to: function(){
|
||||||
|
return (this.get('..').data || {}).to ?? [] },
|
||||||
|
// XXX pages linking to us...
|
||||||
|
'from': function(){
|
||||||
|
return (this.get('..').data || {})['from'] ?? [] },
|
||||||
|
|
||||||
|
|
||||||
|
// actions...
|
||||||
|
//
|
||||||
|
delete: function(){
|
||||||
|
this.location = '..'
|
||||||
|
this.delete()
|
||||||
|
return this.text },
|
||||||
|
// XXX System/back
|
||||||
|
// XXX System/forward
|
||||||
|
// XXX System/sort
|
||||||
|
// XXX System/reverse
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,8 @@
|
|||||||
<style>
|
<style>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<script src="ext-lib/pouchdb.js"></script>
|
||||||
|
|
||||||
<!--script data-main="pwiki2" src="ext-lib/require.js"></script-->
|
<!--script data-main="pwiki2" src="ext-lib/require.js"></script-->
|
||||||
<script src="ext-lib/require.js"></script>
|
<script src="ext-lib/require.js"></script>
|
||||||
<script>
|
<script>
|
||||||
@ -46,7 +48,9 @@ require.config({
|
|||||||
})
|
})
|
||||||
|
|
||||||
var setup = function(){
|
var setup = function(){
|
||||||
require(['./browser'], function(){ })
|
require(['./browser'], function(m){
|
||||||
|
window.pwiki = m.pwiki
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
121
pwiki2.js
121
pwiki2.js
@ -1,22 +1,52 @@
|
|||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* XXX ROADMAP:
|
||||||
|
* - run in browser
|
||||||
|
* - basics, loading -- DONE
|
||||||
|
* - test localStorage / sessionStorage -- DONE
|
||||||
|
* - test pouch -- DONE
|
||||||
|
* - render page
|
||||||
|
* - navigation
|
||||||
|
* - hash/anchor
|
||||||
|
* - service worker
|
||||||
|
* - migrate bootstrap
|
||||||
|
* - test pwa
|
||||||
|
* - archive old code
|
||||||
|
* - update docs
|
||||||
|
* - refactor and cleanup
|
||||||
|
* - pack as electron app (???)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
*
|
||||||
* Architecture:
|
* Architecture:
|
||||||
* store
|
* store
|
||||||
* page
|
* page
|
||||||
* renderer
|
* renderer
|
||||||
*
|
*
|
||||||
|
* Modules:
|
||||||
|
* page - base pages and page APIs (XXX should this be in lib???)
|
||||||
|
* parser - pWiki macro parser (XXX should this be in lib???)
|
||||||
|
* store - stores
|
||||||
|
* base - memory store and store utils
|
||||||
|
* file - file storage
|
||||||
|
* localstorage - localStorage / sessionStorage stores
|
||||||
|
* pouchdb -
|
||||||
|
* ...
|
||||||
|
* filter - page filters
|
||||||
|
* base - base filters incl. wikiword
|
||||||
|
* markdown - markdown renderer
|
||||||
|
* ...
|
||||||
|
* pwiki2 - main cli / node entry point
|
||||||
|
* browser - browser entry point
|
||||||
|
* pwiki2-test - testing and experimenting (XXX move to test.js)
|
||||||
*
|
*
|
||||||
* XXX ROADMAP:
|
*
|
||||||
* - run in browser
|
* Q: can we make this a single module with +/- some plugins??
|
||||||
* - test localStorage / sessionStorage
|
* ...this would make things quite a bit simpler but will negate the
|
||||||
* - test pouch
|
* use of high level libs like types...
|
||||||
* - move the bootstrap over
|
|
||||||
* - test pwa
|
|
||||||
* - archive old code
|
|
||||||
* - update docs
|
|
||||||
* - refactor and cleanup
|
|
||||||
* - pack as electron app (???)
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* XXX weaknesses to review:
|
* XXX weaknesses to review:
|
||||||
@ -26,8 +56,6 @@
|
|||||||
* ...need to be independent of the number of pages if at
|
* ...need to be independent of the number of pages if at
|
||||||
* all possible -- otherwise this will hinder long-term use...
|
* all possible -- otherwise this will hinder long-term use...
|
||||||
* -
|
* -
|
||||||
*
|
|
||||||
*
|
|
||||||
* TODO:
|
* TODO:
|
||||||
* - <page>.then() -- resolve when all pending write operations done ???
|
* - <page>.then() -- resolve when all pending write operations done ???
|
||||||
* - an async REPL???
|
* - an async REPL???
|
||||||
@ -114,80 +142,13 @@ module.store =
|
|||||||
.nest({ __proto__: basestore.MetaStore })
|
.nest({ __proto__: basestore.MetaStore })
|
||||||
|
|
||||||
|
|
||||||
var System =
|
|
||||||
module.System = {
|
|
||||||
// base templates...
|
|
||||||
//
|
|
||||||
_text: {
|
|
||||||
text: '<macro src="." join="\n">@source(.)</macro>' },
|
|
||||||
NotFound: {
|
|
||||||
text: page.PAGE_NOT_FOUND
|
|
||||||
.replace('$PATH', '@source(./path)') },
|
|
||||||
|
|
||||||
// XXX tests...
|
|
||||||
test_list: function(){
|
|
||||||
return 'abcdef'.split('') },
|
|
||||||
|
|
||||||
// metadata...
|
|
||||||
//
|
|
||||||
path: function(){
|
|
||||||
return this.get('..').path },
|
|
||||||
location: function(){
|
|
||||||
return this.get('..').path },
|
|
||||||
dir: function(){
|
|
||||||
return this.get('..').dir },
|
|
||||||
name: function(){
|
|
||||||
return this.get('..').name },
|
|
||||||
ctime: function(){
|
|
||||||
return this.get('..').data.ctime },
|
|
||||||
mtime: function(){
|
|
||||||
return this.get('..').data.mtime },
|
|
||||||
|
|
||||||
// XXX this can be a list for pattern paths...
|
|
||||||
resolved: function(){
|
|
||||||
return this.get('..').resolve() },
|
|
||||||
|
|
||||||
title: function(){
|
|
||||||
var p = this.get('..')
|
|
||||||
return p.title
|
|
||||||
?? p.name },
|
|
||||||
|
|
||||||
|
|
||||||
// utils...
|
|
||||||
//
|
|
||||||
// XXX System/subpaths
|
|
||||||
// XXX
|
|
||||||
links: function(){
|
|
||||||
// XXX
|
|
||||||
return '' },
|
|
||||||
// XXX links to pages...
|
|
||||||
to: function(){
|
|
||||||
return (this.get('..').data || {}).to ?? [] },
|
|
||||||
// XXX pages linking to us...
|
|
||||||
'from': function(){
|
|
||||||
return (this.get('..').data || {})['from'] ?? [] },
|
|
||||||
|
|
||||||
|
|
||||||
// actions...
|
|
||||||
//
|
|
||||||
delete: function(){
|
|
||||||
this.location = '..'
|
|
||||||
this.delete()
|
|
||||||
return this.text },
|
|
||||||
// XXX System/back
|
|
||||||
// XXX System/forward
|
|
||||||
// XXX System/sort
|
|
||||||
// XXX System/reverse
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// XXX note sure how to organize the system actions -- there can be two
|
// XXX note sure how to organize the system actions -- there can be two
|
||||||
// options:
|
// options:
|
||||||
// - a root ram store with all the static stuff and nest the rest
|
// - a root ram store with all the static stuff and nest the rest
|
||||||
// - a nested store (as is the case here)
|
// - a nested store (as is the case here)
|
||||||
// XXX nested system store...
|
// XXX nested system store...
|
||||||
store.update('System',
|
store.update('System',
|
||||||
Object.create(basestore.BaseStore).load(System))
|
Object.create(basestore.BaseStore).load(page.System))
|
||||||
|
|
||||||
|
|
||||||
// NOTE: in general the root wiki api is simply a page instance.
|
// NOTE: in general the root wiki api is simply a page instance.
|
||||||
|
|||||||
@ -50,11 +50,18 @@ module.localStorageStore = {
|
|||||||
JSON.stringify(data) },
|
JSON.stringify(data) },
|
||||||
__delete__: function(path){
|
__delete__: function(path){
|
||||||
delete this.data[(this.__prefix__ ?? '')+ path] },
|
delete this.data[(this.__prefix__ ?? '')+ path] },
|
||||||
|
|
||||||
|
clear: function(){
|
||||||
|
for(var e in this.data){
|
||||||
|
if(e.startsWith(this.__prefix__)){
|
||||||
|
delete this.data[e] } }
|
||||||
|
return this },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
// XXX
|
||||||
var localStorageNestedStore =
|
var localStorageNestedStore =
|
||||||
module.localStorageNestedStore = {
|
module.localStorageNestedStore = {
|
||||||
__proto__: base.BaseStore,
|
__proto__: base.BaseStore,
|
||||||
|
|||||||
@ -11,15 +11,18 @@ var object = require('ig-object')
|
|||||||
var types = require('ig-types')
|
var types = require('ig-types')
|
||||||
|
|
||||||
var pwpath = require('../lib/path')
|
var pwpath = require('../lib/path')
|
||||||
|
|
||||||
var base = require('../store/base')
|
var base = require('../store/base')
|
||||||
|
|
||||||
|
// XXX HACK: trick requirejs to delay module loading...
|
||||||
|
var req = require
|
||||||
|
module.PouchDB =
|
||||||
|
typeof(PouchDB) != 'undefined' ?
|
||||||
|
PouchDB
|
||||||
|
: req('pouchdb')
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
// XXX
|
|
||||||
module.PouchDB = undefined
|
|
||||||
|
|
||||||
var PouchDBStore =
|
var PouchDBStore =
|
||||||
module.PouchDBStore = {
|
module.PouchDBStore = {
|
||||||
__proto__: base.BaseStore,
|
__proto__: base.BaseStore,
|
||||||
@ -31,12 +34,8 @@ module.PouchDBStore = {
|
|||||||
|
|
||||||
__data: undefined,
|
__data: undefined,
|
||||||
get data(){
|
get data(){
|
||||||
if(!this.__data){
|
return this.__data
|
||||||
var PouchDB =
|
?? (this.__data = new module.PouchDB(this.__path__)) },
|
||||||
module.PouchDB =
|
|
||||||
require('pouchdb')
|
|
||||||
return (this.__data = new PouchDB(this.__path__)) }
|
|
||||||
return this.__data },
|
|
||||||
set data(value){
|
set data(value){
|
||||||
this.__data = value },
|
this.__data = value },
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user