My solutions to Advent of Code 🎄
My blog, powered by 11ty. Layouts with Pug, styles with Tailwind CSS
Tiny yet mighty convenient AutoHotkey v2 scripts
"Find the fastest bus route between two stops." My solution to the coding challenge by Solidabis
Airport game using defensive programming techniques
mtsknn/awesome-advent-of-code 0
A collection of awesome resources related to the yearly Advent of Code challenge.
The content behind MDN Web Docs
My simple `.bashrc` and `.gitconfig`. Mostly aliases.
mtsknn/eleventy-plugin-syntaxhighlight 0
A pack of Eleventy plugins for syntax highlighting in Markdown, Liquid, and Nunjucks templates.
startedSangwan5688/BlackHole
started time in 14 hours
PR opened mtsknn/mtsknn.fi
Bumps lodash from 4.17.20 to 4.17.21. <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/lodash/lodash/commit/f299b52f39486275a9e6483b60a410e06520c538"><code>f299b52</code></a> Bump to v4.17.21</li> <li><a href="https://github.com/lodash/lodash/commit/c4847ebe7d14540bb28a8b932a9ce1b9ecbfee1a"><code>c4847eb</code></a> Improve performance of <code>toNumber</code>, <code>trim</code> and <code>trimEnd</code> on large input strings</li> <li><a href="https://github.com/lodash/lodash/commit/3469357cff396a26c363f8c1b5a91dde28ba4b1c"><code>3469357</code></a> Prevent command injection through <code>_.template</code>'s <code>variable</code> option</li> <li>See full diff in <a href="https://github.com/lodash/lodash/compare/4.17.20...4.17.21">compare view</a></li> </ul> </details> <br />
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
<details> <summary>Dependabot commands and options</summary> <br />
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labelswill set the current labels as the default for future PRs for this repo and language@dependabot use these reviewerswill set the current reviewers as the default for future PRs for this repo and language@dependabot use these assigneeswill set the current assignees as the default for future PRs for this repo and language@dependabot use this milestonewill set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the Security Alerts page.
</details>
pr created time in a day
create barnchmtsknn/mtsknn.fi
branch : dependabot/npm_and_yarn/lodash-4.17.21
created branch time in a day
PR opened mtsknn/mtsknn.fi
Bumps hosted-git-info from 2.8.8 to 2.8.9. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md">hosted-git-info's changelog</a>.</em></p> <blockquote> <h2><a href="https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9">2.8.9</a> (2021-04-07)</h2> <h3>Bug Fixes</h3> <ul> <li>backport regex fix from <a href="https://github-redirect.dependabot.com/npm/hosted-git-info/issues/76">#76</a> (<a href="https://github.com/npm/hosted-git-info/commit/29adfe5">29adfe5</a>), closes <a href="https://github-redirect.dependabot.com/npm/hosted-git-info/issues/84">#84</a></li> </ul> <p><!-- raw HTML omitted --><!-- raw HTML omitted --></p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/npm/hosted-git-info/commit/8d4b3697d79bcd89cdb36d1db165e3696c783a01"><code>8d4b369</code></a> chore(release): 2.8.9</li> <li><a href="https://github.com/npm/hosted-git-info/commit/29adfe5ef789784c861b2cdeb15051ec2ba651a7"><code>29adfe5</code></a> fix: backport regex fix from <a href="https://github-redirect.dependabot.com/npm/hosted-git-info/issues/76">#76</a></li> <li>See full diff in <a href="https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9">compare view</a></li> </ul> </details> <details> <summary>Maintainer changes</summary> <p>This version was pushed to npm by <a href="https://www.npmjs.com/~nlf">nlf</a>, a new releaser for hosted-git-info since your current version.</p> </details> <br />
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
<details> <summary>Dependabot commands and options</summary> <br />
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labelswill set the current labels as the default for future PRs for this repo and language@dependabot use these reviewerswill set the current reviewers as the default for future PRs for this repo and language@dependabot use these assigneeswill set the current assignees as the default for future PRs for this repo and language@dependabot use this milestonewill set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the Security Alerts page.
</details>
pr created time in a day
create barnchmtsknn/mtsknn.fi
branch : dependabot/npm_and_yarn/hosted-git-info-2.8.9
created branch time in a day
PR opened mtsknn/mtsknn.fi
Bumps ua-parser-js from 0.7.22 to 0.7.28. <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/faisalman/ua-parser-js/commit/1d3c98a10c23915046a362c4e3b3b503fb40d611"><code>1d3c98a</code></a> Revert breaking fix <a href="https://github-redirect.dependabot.com/faisalman/ua-parser-js/issues/279">#279</a> and release as 0.7.28</li> <li><a href="https://github.com/faisalman/ua-parser-js/commit/535f11bd2403910f29dabe6f90adb014ad016747"><code>535f11b</code></a> Delete redundant code</li> <li><a href="https://github.com/faisalman/ua-parser-js/commit/642c0399e831e27c5c86c3b7afee02e876250d01"><code>642c039</code></a> Fix <a href="https://github-redirect.dependabot.com/faisalman/ua-parser-js/issues/492">#492</a> LG TV WebOS detection</li> <li><a href="https://github.com/faisalman/ua-parser-js/commit/3edacddb2474429c55fa39d1e6222d50bbf9266f"><code>3edacdd</code></a> Merge branch 'master' into develop</li> <li><a href="https://github.com/faisalman/ua-parser-js/commit/acc0b91ff5defa2ca9a722874e27277879292907"><code>acc0b91</code></a> Update contributor list</li> <li><a href="https://github.com/faisalman/ua-parser-js/commit/f726dcd1ae4fea51e99b8ca574a1be51fbd70e1a"><code>f726dcd</code></a> Merge branch 'master' into develop</li> <li><a href="https://github.com/faisalman/ua-parser-js/commit/383ca587ef9b8daffcf652ac39fc9b8f3708572e"><code>383ca58</code></a> More test for tablet devices</li> <li><a href="https://github.com/faisalman/ua-parser-js/commit/7c8aa435b26cb14537423cd5fe4ce077e0661db2"><code>7c8aa43</code></a> Minor rearrangement</li> <li><a href="https://github.com/faisalman/ua-parser-js/commit/09aa9105dc370ded9275f70eae1f4eb67394966c"><code>09aa910</code></a> Add new device & browser: Tesla</li> <li><a href="https://github.com/faisalman/ua-parser-js/commit/557cc2198d88068892eec6b61f2b2f4fe6e96314"><code>557cc21</code></a> More test for latest phones with unique form factor (fold/flip/qwerty/swivel)</li> <li>Additional commits viewable in <a href="https://github.com/faisalman/ua-parser-js/compare/0.7.22...0.7.28">compare view</a></li> </ul> </details> <br />
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
<details> <summary>Dependabot commands and options</summary> <br />
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labelswill set the current labels as the default for future PRs for this repo and language@dependabot use these reviewerswill set the current reviewers as the default for future PRs for this repo and language@dependabot use these assigneeswill set the current assignees as the default for future PRs for this repo and language@dependabot use this milestonewill set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the Security Alerts page.
</details>
pr created time in a day
create barnchmtsknn/mtsknn.fi
branch : dependabot/npm_and_yarn/ua-parser-js-0.7.28
created branch time in a day
PR opened mtsknn/mtsknn.fi
Bumps handlebars from 4.7.6 to 4.7.7. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md">handlebars's changelog</a>.</em></p> <blockquote> <h2>v4.7.7 - February 15th, 2021</h2> <ul> <li>fix weird error in integration tests - eb860c0</li> <li>fix: check prototype property access in strict-mode (<a href="https://github-redirect.dependabot.com/wycats/handlebars.js/issues/1736">#1736</a>) - b6d3de7</li> <li>fix: escape property names in compat mode (<a href="https://github-redirect.dependabot.com/wycats/handlebars.js/issues/1736">#1736</a>) - f058970</li> <li>refactor: In spec tests, use expectTemplate over equals and shouldThrow (<a href="https://github-redirect.dependabot.com/wycats/handlebars.js/issues/1683">#1683</a>) - 77825f8</li> <li>chore: start testing on Node.js 12 and 13 - 3789a30</li> </ul> <p>(POSSIBLY) BREAKING CHANGES:</p> <ul> <li>the changes from version <a href="https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md#v460---january-8th-2020">4.6.0</a> now also apply in when using the compile-option "strict: true". Access to prototype properties is forbidden completely by default, specific properties or methods can be allowed via runtime-options. See <a href="https://github-redirect.dependabot.com/wycats/handlebars.js/issues/1633">#1633</a> for details. If you are using Handlebars as documented, you should not be accessing prototype properties from your template anyway, so the changes should not be a problem for you. Only the use of undocumented features can break your build.</li> </ul> <p>That is why we only bump the patch version despite mentioning breaking changes.</p> <p><a href="https://github.com/wycats/handlebars.js/compare/v4.7.6...v4.7.7">Commits</a></p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/handlebars-lang/handlebars.js/commit/a9a8e403213583ca90cb7c872d3a22796c37d961"><code>a9a8e40</code></a> v4.7.7</li> <li><a href="https://github.com/handlebars-lang/handlebars.js/commit/e66aed5b99c1b6c93564f37d627e34e5d60eb76e"><code>e66aed5</code></a> Update release notes</li> <li><a href="https://github.com/handlebars-lang/handlebars.js/commit/7d4d170ce46a53084a41920c5c7387c131357989"><code>7d4d170</code></a> disable IE in Saucelabs tests</li> <li><a href="https://github.com/handlebars-lang/handlebars.js/commit/eb860c08998f8f506360d305d89e1f4b40f72a0a"><code>eb860c0</code></a> fix weird error in integration tests</li> <li><a href="https://github.com/handlebars-lang/handlebars.js/commit/b6d3de7123eebba603e321f04afdbae608e8fea8"><code>b6d3de7</code></a> fix: check prototype property access in strict-mode (<a href="https://github-redirect.dependabot.com/wycats/handlebars.js/issues/1736">#1736</a>)</li> <li><a href="https://github.com/handlebars-lang/handlebars.js/commit/f0589701698268578199be25285b2ebea1c1e427"><code>f058970</code></a> fix: escape property names in compat mode (<a href="https://github-redirect.dependabot.com/wycats/handlebars.js/issues/1736">#1736</a>)</li> <li><a href="https://github.com/handlebars-lang/handlebars.js/commit/77825f8d3522356feb8e4160fac16344104d192b"><code>77825f8</code></a> refator: In spec tests, use expectTemplate over equals and shouldThrow (<a href="https://github-redirect.dependabot.com/wycats/handlebars.js/issues/1683">#1683</a>)</li> <li><a href="https://github.com/handlebars-lang/handlebars.js/commit/3789a309554fd600caeae442f40881cf93eb3b54"><code>3789a30</code></a> chore: start testing on Node.js 12 and 13</li> <li>See full diff in <a href="https://github.com/wycats/handlebars.js/compare/v4.7.6...v4.7.7">compare view</a></li> </ul> </details> <br />
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
<details> <summary>Dependabot commands and options</summary> <br />
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labelswill set the current labels as the default for future PRs for this repo and language@dependabot use these reviewerswill set the current reviewers as the default for future PRs for this repo and language@dependabot use these assigneeswill set the current assignees as the default for future PRs for this repo and language@dependabot use this milestonewill set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the Security Alerts page.
</details>
pr created time in a day
create barnchmtsknn/mtsknn.fi
branch : dependabot/npm_and_yarn/handlebars-4.7.7
created branch time in a day
startedgoogle/zx
started time in 2 days
startedgo-gitea/gitea
started time in 3 days
startedpmndrs/leva
started time in 3 days
startedcyrus-and/gdb-dashboard
started time in 3 days
startedmtsknn/advent-of-code
started time in 3 days
PR opened mtsknn/mtsknn.fi
Bumps y18n from 4.0.0 to 4.0.3. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/yargs/y18n/blob/y18n-v4.0.3/CHANGELOG.md">y18n's changelog</a>.</em></p> <blockquote> <h3><a href="https://www.github.com/yargs/y18n/compare/y18n-v4.0.2...y18n-v4.0.3">4.0.3</a> (2021-04-07)</h3> <h3>Bug Fixes</h3> <ul> <li><strong>release:</strong> 4.x.x should not enforce Node 10 (<a href="https://github-redirect.dependabot.com/yargs/y18n/issues/126">#126</a>) (<a href="https://www.github.com/yargs/y18n/commit/1e21a536e9135d8403a47be88922157a706b7cde">1e21a53</a>)</li> </ul> <h3>4.0.1 (2020-11-30)</h3> <h3>Bug Fixes</h3> <ul> <li>address prototype pollution issue (<a href="https://github-redirect.dependabot.com/yargs/y18n/issues/108">#108</a>) (<a href="https://www.github.com/yargs/y18n/commit/a9ac604abf756dec9687be3843e2c93bfe581f25">a9ac604</a>)</li> </ul> <p><!-- raw HTML omitted --><!-- raw HTML omitted --></p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/yargs/y18n/commit/0aa97c508ea31efadd2a27f98fed6873eefc963e"><code>0aa97c5</code></a> chore: release 4.x.x (<a href="https://github-redirect.dependabot.com/yargs/y18n/issues/128">#128</a>)</li> <li><a href="https://github.com/yargs/y18n/commit/a8e7f04f8011423ce526e9b9f7ceea190c032733"><code>a8e7f04</code></a> build(release-please): configure branch properly (<a href="https://github-redirect.dependabot.com/yargs/y18n/issues/127">#127</a>)</li> <li><a href="https://github.com/yargs/y18n/commit/1e21a536e9135d8403a47be88922157a706b7cde"><code>1e21a53</code></a> fix(release): 4.x.x should not enforce Node 10 (<a href="https://github-redirect.dependabot.com/yargs/y18n/issues/126">#126</a>)</li> <li><a href="https://github.com/yargs/y18n/commit/8dc75802f3aa944bf9a827213969d64834621215"><code>8dc7580</code></a> docs: update CHANGELOG</li> <li><a href="https://github.com/yargs/y18n/commit/7de58ca0d315990cdb38234e97fc66254cdbcd71"><code>7de58ca</code></a> fix: address prototype pollution issue</li> <li>See full diff in <a href="https://github.com/yargs/y18n/compare/v4.0.0...y18n-v4.0.3">compare view</a></li> </ul> </details> <details> <summary>Maintainer changes</summary> <p>This version was pushed to npm by <a href="https://www.npmjs.com/~oss-bot">oss-bot</a>, a new releaser for y18n since your current version.</p> </details> <br />
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
<details> <summary>Dependabot commands and options</summary> <br />
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labelswill set the current labels as the default for future PRs for this repo and language@dependabot use these reviewerswill set the current reviewers as the default for future PRs for this repo and language@dependabot use these assigneeswill set the current assignees as the default for future PRs for this repo and language@dependabot use this milestonewill set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the Security Alerts page.
</details>
pr created time in 6 days
create barnchmtsknn/mtsknn.fi
branch : dependabot/npm_and_yarn/y18n-4.0.3
created branch time in 6 days
created repositorySteellow/tietokantaohjelmointi-harjoitustyo
School stuff ʕ•́ᴥ•̀ʔっ
created time in 17 days
startedgruntwork-io/git-xargs
started time in 17 days
startedKyleKun/one_second_diary
started time in 23 days
issue closedMithrilJS/mithril.js
Route is not resolved on hash change in IE
Hello!
I found that in IE supportsPushState is true, but onpopstate will never be called. So links does not work.
Example here: https://jsfiddle.net/1bj54j8v/
closed time in 23 days
uNmAnNeRissue commentMithrilJS/mithril.js
Route is not resolved on hash change in IE
This ticket is 3 years old, and IE is no longer a support target. I'm closing this because with the passing of time, this no longer constitutes a bug.
comment created time in 23 days
issue closedMithrilJS/mithril.js
Docs / simple app : prefer component state over ad-hoc static object for stateful models
As discussed in the chat over the last few minutes, the simple app documentation's dependency on an ad-hoc static object for stateful storage quickly becomes contrived when the model it seeks to represent maps one-to-one with the concerns of the component. One David Wraith was struck by edge cases in the model design that would be nullified or easily mitigated by binding the model to the component state.
The received implication of the simple app model is that "stateful components are bad" but for this example stateful components are a solution that avoids state management problems.
PR forthcoming.
closed time in 23 days
barneycarrollissue closedMithrilJS/mithril.js
How to access the current route on the first load?
Im making this issue as a follow up to a discussion on the gitter channel.
Currently there is no simple way to establish, outside of components, what the current route is on the first load. e.g if you have m.route.get() in a module it will be undefined if mithril has not finished the first render.
I don't know what the answer is but I feel like a hook for being able to know when this information is available would be useful
closed time in 23 days
dontworkissue commentMithrilJS/mithril.js
How to access the current route on the first load?
For posterity: m.route.get() will always return the currently settled route. The one place this may not be what one expects is in RouteResolver.onmatch - a route has not resolved until its onmatch returns so it makes sense for m.route.get() to return the last matched route until that point. The route in the process of being matched is exposed to onmatch via its input arguments.
comment created time in 23 days
issue closedMithrilJS/mithril.js
As of yesterday nearly all of the content on the Mithril wiki is outdated and I'm bringing this up here so we can discuss what to do with all the resources which point to 0.2.* projects.
closed time in 23 days
dontworkissue closedMithrilJS/mithril.js
We keep on running into issues with things not being published and the repo root is starting to get messy. I think it's time for a monorepo.
@pygy, @isiahmeadows, @lhorie, anyone feel strongly for or against this plan?
Work has already started here: https://github.com/tivac/mithril.js/tree/monorepo
closed time in 24 days
tivacissue closedMithrilJS/mithril.js
Extend (present, previous) signature to all component methods
I wanted to bring this up for discussion while public vnode-exposing API changes were fresh in people's minds off the back of #1744.
The proposal is to have view and all other lifecycle methods match the onbeforeremove (OBR) signature.
This would in theory allow some interesting opportunities:
- view could subsume OBR behaviour behaviour by returning the old vnode or its instance, allowing for a less object-oriented approach
- views and updates can perform transitions between attribute states
- oninit / oncreate can perform incoming logic depending on the previous node in place
I haven't looked into feasibility.
Any thoughts?
closed time in 24 days
barneycarrollissue closedMithrilJS/mithril.js
How to do redirection with m.route correctly?
For example I want my application to redirect automatically from #!/c to #!/b.
At the first glance it works as expected by using m.route.set in the view method of a Component or in the onmatch method of a RouteResolver. Am I a using it as intended or are there other, more correct ways?
Here is my example code:
const menu = {
view: function() {
return m('nav', [
m('#', 'current route: ' + m.route.get()),
m('a[href=/a]', {oncreate: m.route.link}, 'a'),
m('a[href=/b]', {oncreate: m.route.link}, 'b'),
m('a[href=/c]', {oncreate: m.route.link}, 'c'),
m('a[href=/d]', {oncreate: m.route.link}, 'd')
])
}
}
const a = {
view: function() {
return [
m(menu),
m('#', 'page: a')
];
}
};
const b = {
view: function() {
return [
m(menu),
m('#', 'page: b')
];
}
};
const redirectToBWithComponent = {
view: function() {
m.route.set('/b');
}
};
const redirectToBWithRouteResolver = {
onmatch: function() {
m.route.set('/b');
}
};
m.route(document.body, '/a', {
'/a': a,
'/b': b,
'/c': redirectToBWithComponent,
'/d': redirectToBWithRouteResolver
})
There is a live version of it.
closed time in 24 days
ghost