Commit graph

12 commits

Author SHA1 Message Date
Isiah Meadows
234b1c9302 Update migration, fix various minor issues
- Lot of people couldn't migrate to v1 and plan to reevaluate when v2 is
  released.
- It's "npm" not "NPM". It doesn't stand for anything, and it never
  has - it was initially chosen simply because it was easy to type.
  It has a lot of unofficial backronyms with "Node Package Manager"
  being one of the most common ones, but it's never officially stood
  for anything as an acronym *or* initialism.
- Fixed a few errors in the change log, like non-breaking changes being
  included in the "Breaking Changes" section and an inaccuracy in the
  summary of a particular change.
- Fixed RawGit URLs to point to GitHack, which is a lighter proxy that
  offloads caching to Cloudflare instead of also implementing it itself.
  (It also just uses nginx for all the important server logic, so it
  scales better.)
- Add a few more v0.2 references as appropriate
2019-07-24 05:01:20 -04:00
Isiah Meadows
582bda56dc
Partially recast the router API to be a lot more intuitive. (#2469)
* Recast the router API to be a lot more intuitive.

Fixes #2387
Fixes #2072
Fixes quite a few issues reported on Gitter.

For `m.route.Link`:

- More intuitive
- More accessible
- More ergonomic
- It can be disabled
- It can be cancelled
- It can be changed
- Oh, and you can use it isomorphically.

For `m.route.prefix`

- You can *read* it.
- You can write to it, of course.
- It's literally just setting a property.

For the router itself (and the rest of Mithril):

- You can now `require("mithril")` and all its submodules without a DOM
  at all. There is a catch: you can't instantiate any routes, you can't
  mount anything, and you can't invoke `m.render` in any capacity. You
  can only use `m.route.Link`, `m.route.prefix`, hyperscript stuff, and
  `mithril/stream`, and you can use `m.request` with `background: true`
  if you use a global XHR polyfill. (You can't use `m.request` without
  `background: true` except with a DOM to redraw with.) The goal here is
  to try to get out of the way for simple testing and to defer the
  inevitable `TypeError`s for the relevant DOM methods to runtime.

  The factory requires no arguments, and in terms of globals, you can
  just figure out based on what errors are thrown what globals to
  define. Their values don't matter - they just need to be set to
  *something*, even if it's just `null` or `undefined`, before Mithril
  executes.

Had to make quite a few other changes throughout the docs and tests to
update them accordingly. Oh, and that massive router overhaul enabled me
to do all this.

Also, slip in a few drive-by fixes to the mocks so they're a little
easier to work with and can accept more URLs. This was required for a
few of the tests.

* Update changelog + numbers, add forgotten bundle option

* Add PR numbers to changelog [skip ci]

* Allow continuing to the next match by returning `false`.

* Update numbers again
2019-07-12 15:29:37 -04:00
Erik Vullings
8a7eae00ed Fix for #2423. request.data => body, params is used for querystrings (#2425)
* Fix for #2423. request.data is replaced by body, params is used for querystring interpolation.

* Updated documentation after code review by shadowhand and isiahmeadows

* Convert indentation to tabs

* Replacing m.request.data and m.jsonp.data with params or body.

* Update request.md


Co-authored-by: Isiah Meadows <contact@isiahmeadows.com>
2019-06-10 19:36:32 -04:00
Isiah Meadows
26b8d994ce
Remove m.prop + m.withAttr (#2317)
* Remove `m.prop` + `m.withAttr`

- For many uses, `m.withAttr` is *more* verbose than just directly using
  an event handler
- If you're using it with a bound callback, you're literally wasting a
  single character in the human readable version (and you're *saving*
  them in the minified output).
- It sometimes obscures your intent, if overused.
- Functions are easier to compress than `m.withAttr`, resulting in
  slightly smaller bundles.
- `m.withAttr` is overused anyways.
- `m.prop` is basically useless without `m.withAttr`, and the API
  doesn't have the same benefits it had with 0.2.x.

* Update changelog
2018-11-30 20:41:24 -05:00
Isiah Meadows
6042b001f0
Add m.prop (#2268)
Fixes #2095
2018-11-07 12:18:55 -05:00
Leo
d40b324645 doc fixes 2017-01-08 14:47:38 -05:00
Leo Horie
b1330667e4 fix global assignment 2016-12-07 12:42:30 -05:00
Leo Horie
50d727d017 lint docs 2016-12-02 21:19:19 -05:00
Leo Horie
cdb9017a72 update docs, add descriptions for api methods 2016-12-02 17:51:07 -05:00
Leo Horie
439cf95673 expose promise polyfill in a way that won't need code migration later 2016-11-16 21:15:23 -05:00
Leo Horie
6ce2a384ec simplify streams, lint docs 2016-11-15 23:13:38 -05:00
Leo Horie
04ffdae2a3 some more docs 2016-10-26 10:56:36 -04:00