Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Commit 28bd011

Browse files
committed
added function to be able to open pages in new browser tab
1 parent 97ea61c commit 28bd011

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
22
"name": "saffroncodejs",
3-
"version": "1.9.7",
3+
"version": "1.9.9",
44
"description": "Package of optimised react components and javascript functions for developers ♫♪",
55
"main": "./lib/SaffronCode.js",
66
"types": "./lib/SaffronCode.d.ts",
77
"directories": {
88
"doc": "doc"
99
},
1010
"scripts": {
11-
"build": "rmdir lib /s /q && tsc",
11+
"build": "rmdir lib /s /q && tsc",
12+
"buildLinux": "rm -rf lib /s /q && tsc",
1213
"copy-files": "cp ./src/ ./dist/",
1314
"test": "echo \"Error: no test specified\" && exit 1"
1415
},

src/framework/pageManager/PageManager.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface PageManagerModel {
1212
PAGE_CHANGED:string,
1313
routerParamList:string,
1414
changePage:typeof changePage,
15+
changePageURL:typeof changePageURL,
1516
decodePageParams:typeof decodePageParams,
1617
getCurrentPage:typeof getCurrentPage,
1718
registerPage:typeof registerPage,
@@ -23,6 +24,7 @@ var PageManager:PageManagerModel = {
2324
PAGE_CHANGED : "PAGE_CHANGED",
2425
routerParamList:'',
2526
changePage:changePage,
27+
changePageURL:changePageURL,
2628
decodePageParams:decodePageParams,
2729
getCurrentPage:getCurrentPage,
2830
registerPage:registerPage,
@@ -44,6 +46,25 @@ function registerPage(page:PageData):void
4446

4547
var cashedLastPage = new PageData();
4648

49+
function changePageURL(targetPage:PageData,pageData:any[]=[]):string
50+
{
51+
if(targetPage!==null)
52+
{
53+
cashedLastPage = JSON.parse(JSON.stringify(targetPage)) ;
54+
for(var i = 0 ; i<pageData.length ; i++)
55+
{
56+
if(pageData[i]===undefined || pageData[i]===null || pageData[i]==='')
57+
{
58+
pageData[i] = '~';
59+
}
60+
cashedLastPage.url += '/'+encodeURIComponent(pageData[i]) ;
61+
}
62+
return cashedLastPage.url ;
63+
}
64+
return '.';
65+
}
66+
67+
4768
function changePage(targetPage:PageData,pageData:any[]=[]):void
4869
{
4970
if(targetPage!==null)

0 commit comments

Comments
 (0)