mirror of
https://github.com/flynx/pWiki.git
synced 2025-11-01 03:20:08 +00:00
experimenting with path encoding + events...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
888f303a4a
commit
d83711ff73
@ -50,6 +50,13 @@ module = {
|
|||||||
// XXX or can we?
|
// XXX or can we?
|
||||||
SYSTEM_PATH: '/.system',
|
SYSTEM_PATH: '/.system',
|
||||||
|
|
||||||
|
// XXX EXPERIMENTAL
|
||||||
|
encode: function(str){
|
||||||
|
return str
|
||||||
|
.replace(/[#:*%]/g, encodeURIComponent) },
|
||||||
|
decode: function(str){
|
||||||
|
return decodeURIComponent(str) },
|
||||||
|
|
||||||
/*/ XXX NORMCACHE...
|
/*/ XXX NORMCACHE...
|
||||||
__normalized_cache_threshold: 100,
|
__normalized_cache_threshold: 100,
|
||||||
__normalized_cache_size: 4096,
|
__normalized_cache_size: 4096,
|
||||||
|
|||||||
@ -140,6 +140,9 @@ module.BaseStore = {
|
|||||||
// XXX revise naming...
|
// XXX revise naming...
|
||||||
next: undefined,
|
next: undefined,
|
||||||
|
|
||||||
|
onUpdate: types.event.Event('update'),
|
||||||
|
onDelete: types.event.Event('delete'),
|
||||||
|
|
||||||
// NOTE: .data is not part of the spec and can be implementation-specific,
|
// NOTE: .data is not part of the spec and can be implementation-specific,
|
||||||
// only .__<name>__(..) use it internally... (XXX check this)
|
// only .__<name>__(..) use it internally... (XXX check this)
|
||||||
__data: undefined,
|
__data: undefined,
|
||||||
@ -542,6 +545,7 @@ module.BaseStore = {
|
|||||||
await this.__update__(path, data, mode)
|
await this.__update__(path, data, mode)
|
||||||
// XXX CACHED
|
// XXX CACHED
|
||||||
this.__cache_add(path)
|
this.__cache_add(path)
|
||||||
|
this.onUpdate(path)
|
||||||
return this },
|
return this },
|
||||||
__delete__: async function(path){
|
__delete__: async function(path){
|
||||||
delete this.data[path] },
|
delete this.data[path] },
|
||||||
@ -554,7 +558,8 @@ module.BaseStore = {
|
|||||||
if(path){
|
if(path){
|
||||||
await this.__delete__(path)
|
await this.__delete__(path)
|
||||||
// XXX CACHED
|
// XXX CACHED
|
||||||
this.__cache_remove(path) }
|
this.__cache_remove(path)
|
||||||
|
this.onDelete(path) }
|
||||||
return this },
|
return this },
|
||||||
|
|
||||||
// XXX NEXT might be a good idea to have an API to move pages from
|
// XXX NEXT might be a good idea to have an API to move pages from
|
||||||
|
|||||||
11
pwiki2.js
11
pwiki2.js
@ -6,10 +6,15 @@
|
|||||||
* - fs store/export in browser or a simple way to export/import...
|
* - fs store/export in browser or a simple way to export/import...
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* XXX need page names to contain odd characters when created by user, for
|
||||||
|
* example: note titles...
|
||||||
|
* ...and need this to work through all the i/o...
|
||||||
|
* ....this might be an argument towards the .title attr, at least
|
||||||
|
* for notes...
|
||||||
* XXX need basic system events:
|
* XXX need basic system events:
|
||||||
* <page>.onUpdate(path, data?)
|
* <store>.onUpdate(path, data?)
|
||||||
* <page>.onUreate(path, data?)
|
* <store>.onCreate(path, data?)
|
||||||
* <page>.onDelete(path)
|
* <store>.onDelete(path)
|
||||||
* ..stores should also be able to trigger these when external
|
* ..stores should also be able to trigger these when external
|
||||||
* updates are detected...
|
* updates are detected...
|
||||||
* XXX CACHE strategy and architecture
|
* XXX CACHE strategy and architecture
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user