@-0/browser
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -1,6 +0,4 @@ | ||
export declare const popstate$: any; | ||
export declare const DOMContentLoaded$: any; | ||
export declare const DOMnavigated$: import("@thi.ng/rstream").ISubscription<unknown, { | ||
URL_FULL: any; | ||
DOM_NODE: any; | ||
}>; | ||
import { ISubscribable } from "@thi.ng/rstream"; | ||
export declare const popstate$: ISubscribable<any>; | ||
export declare const DOMContentLoaded$: ISubscribable<any>; | ||
export declare const DOMnavigated$: import("@thi.ng/rstream").ISubscription<unknown, any>; |
@@ -8,5 +8,17 @@ import { fromDOMEvent, merge } from "@thi.ng/rstream"; | ||
src: [popstate$, DOMContentLoaded$] | ||
}).transform(map((x) => ({ | ||
[URL_FULL]: x.target.location.href, | ||
[DOM_NODE]: x.currentTarget | ||
}))); | ||
}).transform({ | ||
xform: map((x) => { | ||
if (x.target.location.href && x.currentTarget) { | ||
return { | ||
[URL_FULL]: x.target.location.href, | ||
[DOM_NODE]: x.currentTarget | ||
}; | ||
} | ||
console.log("DOMnavigated$ triggered, but missing `x.target.location.href &/ x.currentTarget`", JSON.stringify(x, null, 2)); | ||
return x; | ||
}), | ||
error: e => { | ||
console.warn("error in DOMnavigated$:", e); | ||
return true; | ||
} | ||
}); |
@@ -7,3 +7,4 @@ import { DOM_NODE, URL_FULL, CMD_SUB$, CMD_ARGS, CMD_SRC$, CMD_WORK } from "@-0/keys"; | ||
export const registerRouterDOM = (router) => { | ||
const task = URL_DOM__ROUTE(router); | ||
console.log("DOM Router Registered"); | ||
const routing_task = URL_DOM__ROUTE(router); | ||
return registerCMD({ | ||
@@ -18,3 +19,3 @@ [CMD_SRC$]: DOMnavigated$, | ||
if (url && node) | ||
return run$.next(task(props)); | ||
return run$.next(routing_task(props)); | ||
console.warn(Err_missing_props("_URL_NAVIGATED$_DOM (registerRouterDOM)", props)); | ||
@@ -21,0 +22,0 @@ } |
@@ -35,6 +35,3 @@ import { isPlainObject } from "@thi.ng/checks"; | ||
[CMD_ARGS]: acc[URL_FULL] ? router(acc[URL_FULL].replace(prefix, "")) : new Error(e_s), | ||
[CMD_RESO]: (_acc, _res) => ({ | ||
[URL_PAGE]: (_res && _res[URL_PAGE]) || null, | ||
[URL_DATA]: (_res && _res[URL_DATA]) || null | ||
}), | ||
[CMD_RESO]: (_acc, _res) => (Object.assign(Object.assign({}, _res && _res[URL_PAGE] && { [URL_PAGE]: _res[URL_PAGE] }), { [URL_DATA]: (_res && _res[URL_DATA]) || null })), | ||
[CMD_ERRO]: route_error | ||
@@ -41,0 +38,0 @@ }, |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Browser helpers for -0 state management, routing and the interaction between", | ||
@@ -35,5 +35,5 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"@-0/keys": "^0.3.3", | ||
"@-0/utils": "^0.3.3", | ||
"@-0/spool": "^0.3.1", | ||
"@-0/keys": "^0.3.4", | ||
"@-0/utils": "^0.3.4", | ||
"@-0/spool": "^0.3.2", | ||
"@thi.ng/paths": "^4.2.7", | ||
@@ -52,3 +52,3 @@ "@thi.ng/rstream": "^6.0.8" | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^15.3.0", | ||
"@types/node": "^15.6.0", | ||
"@typescript-eslint/eslint-plugin": "^4.24.0", | ||
@@ -59,3 +59,3 @@ "@typescript-eslint/parser": "^4.24.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^7.26.0", | ||
"eslint": "^7.27.0", | ||
"gh-pages": "^3.1.0", | ||
@@ -62,0 +62,0 @@ "jest": "^26.6.3", |
44939
493
Updated@-0/keys@^0.3.4
Updated@-0/spool@^0.3.2
Updated@-0/utils@^0.3.4