2.2.0
Hey there. Likely 2.2 is large, prepare for the cool stuff!
Single-page applications
With this release, we bring a much better support for single-page applications.
History API support
Most modern single-page apps use History API which allows developers navigate between pages without refreshing them. Since 2.2, Likely supports this API out of the box! If you place the buttons on a page and then do history.pushState()
or history.replaceState()
, Likely will automatically catch these changes and update itself. (Navigating backwards and forwards is also supported, of course.)
If you don’t use History API, don’t worry, Likely will continue to work for you the same way.
Thanks to @vitkarpov and @iamakulov (#63, #100 and others)
Fixes for repeated likely.initiate()
Previously, our likely.initiate()
behavior was buggy: once you initialized the buttons for the first time, it was really hard to re-initialize them again. Now, this method works just like you’d expect: each time you run it, it always gets the freshest options and updates Likely. If you develop an SPA but don’t use the History API, this is exactly for you.
As a reminder, you can pass options both in JavaScript:
likely.initiate({ url: 'http://ilyabirman.net', counters: false })and by setting the DOM attributes:
<div class="likely" data-url="http://ilyabirman.net" data-counters="no">
(#84 by @vitkarpov, #109 by @iamakulov)
Non-single-page-apps-related
LinkedIn button
We thought Likely 2.2 would be only SPA-related, but unexpectedly, @350d came in and brought us a new LinkedIn button:
Use it just like the other buttons:
<div class="linkedin">Share</div>
Thanks to @ld0rman (which PR #16 we unfortunately rejected, but started considering this idea) and @350d (for bringing this idea again and submitting a fresh PR #101).
Decreased file size
likely.js
is 19.3 Kb in Likely 2.2 – almost twice smaller than Likely 2.1.3 with 36.2 Kb.
(#108 by @iamakulov)
Deprecations
Starting with Likely 2.2, we deprecate two methods: likely()
and likely.initate()
(note the typo). The only supported method for initializing is now likely.initiate()
. The reasoning behind this is that between likely()
and likely.initiate()
, only the latter was documented, and likely.initate()
was just a typo that accidentally made itself into API.
likely()
and likely.initate()
will continue to work, but start printing warnings about deprecation. We’re going to remove them when we reach v3.0.0.
Instead of this, we extend likely.initiate()
to accept not only options, but also a node or a list of nodes. Use it either way:
likely.initiate();
likely.initiate(nodes);
likely.initiate(options);
likely.initiate(nodes, options);
(#85 and #95 by @vitkarpov)
Under-the-hood improvements
Finally, we’re near the end.
- Tests. We brought automated tests to Likely. This means that every functionality covered with the tests (and it’s a lot of it) will be stable and won’t experience accidental bugs. (#73 and others by @iamakulov)
- Migration to ES2015+. We migrated our codebase to ES2015+ with Babel so Likely are now easier and more pleasant to develop. Contribute! (#79 by @7rulnik)
- Migration to Webpack. This lets us use all the modern tools for development, and this was one of the things that helped us to decrease the files size. (#58 by @andrew--r)
- ESLint. This was made earlier, but it’s worth mentioning here. With ESLint, all our code follows the same style, and we can catch some programming errors early. (#29 by @vitkarpov)