323 jump_history.shift(); |
323 jump_history.shift(); |
324 |
324 |
325 return true; |
325 return true; |
326 }; |
326 }; |
327 |
327 |
328 function* chain(a,b){ |
|
329 yield* a; |
|
330 yield* b; |
|
331 }; |
|
332 |
|
333 function unsubscribe(){ |
|
334 /* remove subsribers */ |
|
335 for(let index of this.indexes){ |
|
336 let idx = index + this.offset; |
|
337 subscribers[idx].delete(this); |
|
338 } |
|
339 this.offset = 0; |
|
340 } |
|
341 |
|
342 function subscribe(new_offset=0){ |
|
343 /* set the offset because relative */ |
|
344 this.offset = new_offset; |
|
345 /* add this's subsribers */ |
|
346 for(let index of this.indexes){ |
|
347 subscribers[index + new_offset].add(this); |
|
348 } |
|
349 need_cache_apply.push(this); |
|
350 } |
|
351 |
|
352 function widget_apply_cache() { |
|
353 for(let index of this.indexes){ |
|
354 /* dispatch current cache in newly opened page widgets */ |
|
355 let realindex = index+this.offset; |
|
356 let cached_val = cache[realindex]; |
|
357 if(cached_val != undefined) |
|
358 dispatch_value_to_widget(this, realindex, cached_val, cached_val); |
|
359 } |
|
360 } |
|
361 |
|
362 function switch_visible_page(page_name) { |
328 function switch_visible_page(page_name) { |
363 |
329 |
364 let old_desc = page_desc[current_visible_page]; |
330 let old_desc = page_desc[current_visible_page]; |
365 let new_desc = page_desc[page_name]; |
331 let new_desc = page_desc[page_name]; |
366 |
332 |