diff --git a/wasm/www/index.js b/wasm/www/index.js index 3ee66c2..e071b83 100644 --- a/wasm/www/index.js +++ b/wasm/www/index.js @@ -53,9 +53,16 @@ function initEvent() { } } +function readPath() { + let query = location.href.substring(location.href.indexOf('#') + 1); + let path = decodeURIComponent(query); + getJsonpathInput().value = path; + forceClick(getReadBtn()); +} + function readPathParam() { if(location.href.indexOf('#') > -1) { - readPath() + readPath(); } } @@ -67,13 +74,6 @@ function forceClick(ctrl) { ctrl.dispatchEvent(event, true); } -function readPath() { - let query = location.href.substring(location.href.indexOf('#') + 1); - let path = decodeURIComponent(query); - getJsonpathInput().value = path; - forceClick(getReadBtn()); -} - window.onpopstate = readPath; -initData('data/example.json').then(initEvent).then(readPathParam); \ No newline at end of file +initData('data/example.json').then(initEvent).then(readPathParam);