graph TB
pub(Publisher)
sub(Subscriber)
ch((Topic or Event Channel))
pub .-> |publish Topic or Event| ch
ch .-> |emit Topic or Event| sub
sub .-> |subscribe Topic or Event| ch
functionoptionalChain(target, propsChain) { var props = propsChain.split(/\??\./) var result while (props.length) { target = result = target[props.shift()] if (result == null) break } return result }
1 2 3 4 5 6 7 8 9 10 11 12
const a = { b: { c: 0 } }
const value = a && a.b && a.b.c && a.b.c.value // 结果: 0
aria2 is a lightweight multi-protocol & multi-source command-line download utility. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink. aria2 can be manipulated via built-in JSON-RPC and XML-RPC interfaces.
aria2 version 1.35.0 Copyright (C) 2006, 2019 Tatsuhiro Tsujikawa
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
** Configuration ** Enabled Features: Async DNS, BitTorrent, Firefox3 Cookie, GZip, HTTPS, Message Digest, Metalink, XML-RPC Hash Algorithms: sha-1, sha-224, sha-256, sha-384, sha-512, md5, adler32 Libraries: zlib/1.2.11 libxml2/2.9.4 sqlite3/3.28.0 AppleTLS GMP/6.1.2 c-ares/1.14.0 Compiler: Apple LLVM 11.0.3 (clang-1103.0.32.62) built by x86_64-apple-darwin19.6.0 on Oct 24 2020 18:19:17 System: Darwin 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64
Report bugs to https://github.com/aria2/aria2/issues Visit https://aria2.github.io/
/** * Rotuer back * @param {Function}[onLaunched] */ CCRotuer.prototype.back = function (onLaunched) { // pop current var _scene = this.routes.pop()
// pop previous or get init scene or current scene var previousScene = this.routes.pop() || this.initScene || _scene
this.navigateTo(previousScene, onLaunched) }
/** * Router setInitScene * @param {string}scene */ CCRotuer.prototype.setInitScene = function (scene) { // get original init scene var _initScene = this.initScene // reassign init scene this.initScene = scene // replace all previous init scene in rotues stack if (_initScene) { for (var i = 0; i < this.routes.length; i++) { if (this.routes[i] === _initScene) { this.router[i] = scene } } } }
/** * Router setInitScene * @param {string}scene */ CCRotuer.prototype.setInitScene = function (scene) { // get original init scene var _initScene = this.initScene // reassign init scene this.initScene = scene // replace all previous init scene in rotues stack if (_initScene) { if (this.routes.length) { for (var i = 0; i < this.routes.length; i++) { if (this.routes[i] === _initScene) { this.router[i] = scene } } } else { this.routes = [scene] } } }
/** * Rotuer back * @param {Function}[onLaunched] */ CCRotuer.prototype.back = function (onLaunched) { // pop current var _scene = this.routes.pop()
// pop previous or get init scene or current scene var previousScene = this.routes.pop() || this.initScene || _scene this.navigateTo(previousScene, onLaunched) }
// create router instance and inject to cc scope cc.router = new CCRotuer('index') })()
const isObject = o =>Object.prototype.toString.call(o) === '[object Object]' functiondeepCloneObject(origin) { const res = {} for (const key in origin) { const value = origin[key] res[key] = isObject(value) ? deepCloneObject(value) : value } return res }