maishu-chitu
Advanced tools
Comparing version 2.13.0 to 2.14.0
/*! | ||
* | ||
* maishu-chitu v2.13.0 | ||
* maishu-chitu v2.14.0 | ||
* https://github.com/ansiboy/chitu | ||
@@ -847,2 +847,3 @@ * | ||
this.nodes = {}; | ||
this.MAX_PAGE_COUNT = 100; | ||
this.error = maishu_chitu_service_1.Callbacks(); | ||
@@ -1055,2 +1056,8 @@ this.parser = parser || this.defaultPageNodeParser(); | ||
this.page_stack.push(page); | ||
if (this.page_stack.length > this.MAX_PAGE_COUNT) { | ||
var _page = this.page_stack.shift(); | ||
if (_page) this.closePage(_page); | ||
} | ||
} | ||
@@ -1057,0 +1064,0 @@ }, { |
/*! | ||
* | ||
* maishu-chitu v2.13.0 | ||
* maishu-chitu v2.14.0 | ||
* https://github.com/ansiboy/chitu | ||
@@ -568,2 +568,3 @@ * | ||
this.nodes = {}; | ||
this.MAX_PAGE_COUNT = 100; | ||
this.error = maishu_chitu_service_1.Callbacks(); | ||
@@ -705,2 +706,7 @@ this.parser = parser || this.defaultPageNodeParser(); | ||
this.page_stack.push(page); | ||
if (this.page_stack.length > this.MAX_PAGE_COUNT) { | ||
let page = this.page_stack.shift(); | ||
if (page) | ||
this.closePage(page); | ||
} | ||
} | ||
@@ -707,0 +713,0 @@ findPageAction(pageUrl) { |
@@ -58,2 +58,3 @@ "use strict"; | ||
this.nodes = {}; | ||
this.MAX_PAGE_COUNT = 100; | ||
this.error = maishu_chitu_service_1.Callbacks(); | ||
@@ -266,2 +267,8 @@ this.parser = parser || this.defaultPageNodeParser(); | ||
this.page_stack.push(page); | ||
if (this.page_stack.length > this.MAX_PAGE_COUNT) { | ||
var _page = this.page_stack.shift(); | ||
if (_page) this.closePage(_page); | ||
} | ||
} | ||
@@ -268,0 +275,0 @@ }, { |
@@ -14,2 +14,3 @@ import { Callback1, Callback2 } from "maishu-chitu-service"; | ||
private nodes; | ||
private MAX_PAGE_COUNT; | ||
error: Callback2<this, Error, Page | null>; | ||
@@ -16,0 +17,0 @@ parser: PageNodeParser; |
@@ -22,2 +22,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
this.nodes = {}; | ||
this.MAX_PAGE_COUNT = 100; | ||
this.error = maishu_chitu_service_1.Callbacks(); | ||
@@ -159,2 +160,7 @@ this.parser = parser || this.defaultPageNodeParser(); | ||
this.page_stack.push(page); | ||
if (this.page_stack.length > this.MAX_PAGE_COUNT) { | ||
let page = this.page_stack.shift(); | ||
if (page) | ||
this.closePage(page); | ||
} | ||
} | ||
@@ -161,0 +167,0 @@ findPageAction(pageUrl) { |
@@ -36,3 +36,3 @@ { | ||
}, | ||
"version": "2.13.0" | ||
"version": "2.14.0" | ||
} |
@@ -29,2 +29,3 @@ import { Callbacks, Callback1, Callback2 } from "maishu-chitu-service"; | ||
private nodes: { [name: string]: PageNode } = {} | ||
private MAX_PAGE_COUNT = 100 | ||
@@ -120,10 +121,8 @@ /** | ||
private getPage(pageUrl: string, values?: any): { page: Page, isNew: boolean } { | ||
// console.assert(node != null); | ||
if (!pageUrl) throw Errors.argumentNull('pageUrl') | ||
values = values || {}; | ||
// let pageName = node.name; | ||
let cachePage = this.cachePages[pageUrl]; | ||
if (cachePage != null) { | ||
cachePage.data = values || {} //Object.assign(cachePage.data || {}, values); | ||
cachePage.data = values || {} | ||
return { page: cachePage, isNew: false }; | ||
@@ -190,6 +189,2 @@ } | ||
// let node = this.findSiteMapNode(pageUrl); | ||
// if (node == null) | ||
// throw Errors.pageNodeNotExists(pageUrl) | ||
if (this.currentPage != null && this.currentPage.url == pageUrl) | ||
@@ -200,3 +195,3 @@ return this.currentPage; | ||
if (isNew || forceRender) { | ||
let action = this.findPageAction(pageUrl) //siteMapNode.action; | ||
let action = this.findPageAction(pageUrl) | ||
if (action == null) | ||
@@ -229,2 +224,7 @@ throw Errors.actionCanntNull(pageUrl); | ||
this.page_stack.push(page); | ||
if (this.page_stack.length > this.MAX_PAGE_COUNT) { | ||
let page = this.page_stack.shift() | ||
if (page) | ||
this.closePage(page) | ||
} | ||
} | ||
@@ -276,3 +276,2 @@ | ||
// page.close(); | ||
this.closePage(page) | ||
@@ -279,0 +278,0 @@ if (this.currentPage) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
399443
6511