Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-10-22 12:49:57 +03:00
parent a5b618ab8c
commit d15d516676

View File

@ -38,6 +38,8 @@ var pwpath = require('../path')
// <index-handler>('get')
// -> <data>
// -> <promise>
// NOTE: when a getter is pending (promise), all consecutive calls
// will resolve the original getter return value...
//
// Get cached result and do "lazy" background update... (XXX EXPERIMENTAL)
// <index-handler>('lazy')
@ -46,6 +48,9 @@ var pwpath = require('../path')
// NOTE: 'lazy' mode is generally faster as it does all the checks and
// updating (if needed) in a background promise, but can return
// outdated cached results.
// NOTE: as a side-effect this avoids returning promises if a cached
// value is available. i.e. a promise is returned only when
// getting/generating a value for the first time.
//
// Get local data (uncached)...
// <index-handler>('local')
@ -65,9 +70,6 @@ var pwpath = require('../path')
// -> <data>
// -> <promise>
//
// NOTE: when a getter is pending (promise), all consecutive calls will
// resolve the original getter return value...
//
//
//
// Special methods:
@ -177,7 +179,8 @@ function(name, generate, options={}){
function(value){
delete obj[promise]
obj[cache] = value },
function(){
function(err){
// XXX should we report this???
delete obj[promise] }) }
val = obj[promise] }
return val }