mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 10:00: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?
|
||||
SYSTEM_PATH: '/.system',
|
||||
|
||||
// XXX EXPERIMENTAL
|
||||
encode: function(str){
|
||||
return str
|
||||
.replace(/[#:*%]/g, encodeURIComponent) },
|
||||
decode: function(str){
|
||||
return decodeURIComponent(str) },
|
||||
|
||||
/*/ XXX NORMCACHE...
|
||||
__normalized_cache_threshold: 100,
|
||||
__normalized_cache_size: 4096,
|
||||
|
||||
@ -140,6 +140,9 @@ module.BaseStore = {
|
||||
// XXX revise naming...
|
||||
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,
|
||||
// only .__<name>__(..) use it internally... (XXX check this)
|
||||
__data: undefined,
|
||||
@ -542,6 +545,7 @@ module.BaseStore = {
|
||||
await this.__update__(path, data, mode)
|
||||
// XXX CACHED
|
||||
this.__cache_add(path)
|
||||
this.onUpdate(path)
|
||||
return this },
|
||||
__delete__: async function(path){
|
||||
delete this.data[path] },
|
||||
@ -554,7 +558,8 @@ module.BaseStore = {
|
||||
if(path){
|
||||
await this.__delete__(path)
|
||||
// XXX CACHED
|
||||
this.__cache_remove(path) }
|
||||
this.__cache_remove(path)
|
||||
this.onDelete(path) }
|
||||
return this },
|
||||
|
||||
// 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...
|
||||
*
|
||||
*
|
||||
* 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:
|
||||
* <page>.onUpdate(path, data?)
|
||||
* <page>.onUreate(path, data?)
|
||||
* <page>.onDelete(path)
|
||||
* <store>.onUpdate(path, data?)
|
||||
* <store>.onCreate(path, data?)
|
||||
* <store>.onDelete(path)
|
||||
* ..stores should also be able to trigger these when external
|
||||
* updates are detected...
|
||||
* XXX CACHE strategy and architecture
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user