From 71df390ea740de1b0e24e9bf7a4382bb8e371136 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 7 Feb 2019 20:38:11 +0100 Subject: [PATCH] add explorations --- explorations/html5.html | 11 +++++++++++ explorations/html5.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 explorations/html5.html create mode 100644 explorations/html5.ts diff --git a/explorations/html5.html b/explorations/html5.html new file mode 100644 index 00000000..e3e0b259 --- /dev/null +++ b/explorations/html5.html @@ -0,0 +1,11 @@ + + + + + + + Testing History HTML5 + + + + diff --git a/explorations/html5.ts b/explorations/html5.ts new file mode 100644 index 00000000..6ed60906 --- /dev/null +++ b/explorations/html5.ts @@ -0,0 +1,35 @@ +import HTML5History from '../src/history/html5' +import { Router } from '../src' + +const component = null + +const r = new Router({ + history: new HTML5History(), + routes: [ + { path: '/', component }, + { path: '/users/:id', name: 'user', component }, + { path: /^\/about\/?$/, component }, + ], +}) + +const h = new HTML5History() +// @ts-ignore +window.h = h +// @ts-ignore +window.r = r + +h.listen((to, from) => { + console.log({ to, from }) +}) + +r.push('/about') +r.push({ + path: '/', +}) + +r.push({ + name: 'user', + params: { + id: '6', + }, +}) -- 2.47.3