Comparing version 2.12.0-0 to 2.12.0-1
{ | ||
"name": "ralltiir", | ||
"version": "2.12.0-0", | ||
"version": "2.12.0-1", | ||
"discription": "前端极速浏览框架,目标是提升用户体验,提供沉浸式浏览方式。", | ||
@@ -13,3 +13,2 @@ "scripts": { | ||
"preversion": "npm run lint && npm test", | ||
"postversion": "git push origin master && git push origin --tags", | ||
"clean": "make clean", | ||
@@ -16,0 +15,0 @@ "lint": "fecs check src, test" |
@@ -140,2 +140,17 @@ /** | ||
// MAGIC: 处理魔法 service 子路由 | ||
// 这类子路由可以让 service 拥有自己的子路由的同时,前进或后退到其它 service 时能够不监听 popstate。 | ||
var isMagicRouter = _.get(current, 'options.superMagicRouter'); | ||
if (isMagicRouter) { | ||
var prevServiceEntry = services.urlEntries.get(prev.pathPattern); | ||
var currentServiceEntry = services.urlEntries.get(current.pathPattern); | ||
if (prevServiceEntry.service === currentServiceEntry.service) { | ||
services.copyServiceMapping(prev.url, current.url); | ||
logger.log('copy service from ' + prev.url + ' to ' + current.url); | ||
return; | ||
} | ||
// else | ||
logger.log('magic router found, but service entry not equals.'); | ||
} | ||
var prevService = services.getOrCreate(prev.url, prev.pathPattern); | ||
@@ -151,2 +166,9 @@ prev.service = prevService; | ||
// MAGIC: 魔法子路由需要的魔法 | ||
// 在两个实例相等,又都不是单例的情况下,认为是被复制的;此时不做 dispatch | ||
if (prevService && prevService === currentService && !prevService.singleton) { | ||
logger.log('prev service and current service are the same. disabled dispatch.'); | ||
return; | ||
} | ||
if (!pages.contains(current.url)) { | ||
@@ -364,3 +386,3 @@ pages.set(current.url, { | ||
if (options.silent) { | ||
transferPageTo(url, query); | ||
copyPageTo(url, query); | ||
} | ||
@@ -432,3 +454,3 @@ router.redirect(url, query, options); | ||
transferPageTo(url, query); | ||
copyPageTo(url, query); | ||
_.assign(stageData, data); | ||
@@ -438,3 +460,3 @@ router.reset(url, query, options); | ||
function transferPageTo(url, query) { | ||
function copyPageTo(url, query) { | ||
var noRootUrl = router.ignoreRoot(location.pathname + location.search); | ||
@@ -450,3 +472,2 @@ var from = router.createURL(noRootUrl).toString(); | ||
pages.set(to, pages.get(from)); | ||
// pages.rename(from, to); | ||
} | ||
@@ -616,3 +637,3 @@ | ||
var page = pages.get(currUrl); | ||
transferPageTo(url, options.query); | ||
copyPageTo(url, options.query); | ||
@@ -619,0 +640,0 @@ options = _.assign({}, { |
@@ -26,3 +26,2 @@ /** | ||
register: register, | ||
postMessage: postMessage, | ||
unRegister: unRegister, | ||
@@ -33,2 +32,3 @@ isRegistered: isRegistered, | ||
setInstanceLimit: setInstanceLimit, | ||
copyServiceMapping: copyServiceMapping, | ||
urlEntries: null | ||
@@ -70,16 +70,2 @@ }; | ||
function postMessage(msg, target) { | ||
assert(target, 'message target should be set explicitly'); | ||
serviceInstances.forEach(function (service) { | ||
if (!_.isFunction(service.onMessage)) { | ||
return; | ||
} | ||
if (target === '*' || target === service.name) { | ||
setTimeout(function () { | ||
service.onMessage(msg); | ||
}); | ||
} | ||
}); | ||
} | ||
function isRegistered(pathPattern) { | ||
@@ -139,4 +125,20 @@ return urlEntries.has(pathPattern); | ||
/** | ||
* 拷贝 service 和 url 的对应关系 | ||
* | ||
* @param {string} from 拷贝源 url | ||
* @param {string} to 拷贝目标 url | ||
* @return {boolean} 是否拷贝成功(不成功是因为没有源 service) | ||
*/ | ||
function copyServiceMapping(from, to) { | ||
var id = url2id.get(from); | ||
if (id !== undefined) { | ||
url2id.set(to, id); | ||
return true; | ||
} | ||
return false; | ||
} | ||
return exports; | ||
}; | ||
}); |
@@ -149,13 +149,2 @@ /** | ||
/** | ||
* Traverse all items available | ||
* | ||
* @param {Function} cb(value, key) The callback to iterate with | ||
*/ | ||
forEach: function (cb) { | ||
this.list.forEach(function (item) { | ||
cb(item.value, item.key); | ||
}); | ||
}, | ||
size: function () { | ||
@@ -162,0 +151,0 @@ return this.list.length; |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
3952
1
124193
37