There's now a new Client#matches method. It accepts a platform query and
returns a boolean, whether the platform matches. The ClientList#filter
method now depends on the clients to know whether they belong.
Two reasons why:
- The query API was untested before *shudders*
- Now that you can use clients alone (without a list), it adds API
symmetry and isolates concerns.
- It exposes the API for every client, giving more power to the
developer.
Yipes, looks like I still had a bunch of rules stuffed in my
eslintrc file. A while ago I pulled those out into a standalone eslint
config. This commit adds that config, removes all the duplicated rules,
and fixes the errors ensuing from revised formatting preferences.
Editorconfig files help you keep a consistent style across projects.
Recently, I've been using it to enforce spaces over tabs (I switched).
This commit adds the config file and changes the project indent
style to match.
New script, "all-tests", runs the unit tests and the linter. The "test"
script now just refers to unit tests.
Instead of reporting just an error, jobs now respond with an object.
That object contains the return value from the job, or it's error. It
also allows more features to be added in the future, potentially by 3rd
party plugins.
The Client constructor now makes sure that the handshake object it's
given is valid. Also, the constructor is now exposed to the world
through the `panic.Client` property.
Now, with the sparkling new client API, each client is responsible for
running their own jobs. Instead of inlining all that logic in
ClientList#run, it just dispatches the job to each client and wraps it
in Promise.all. Yay for simplicity!!!
One side effect: job IDs won't be the same across clients.
Addressing another panic pain point: you have to jump through insane,
unintuitive hoops just to access a single, non-dynamic client.
Useful for picking out clients and running code on JUST one, without
needing dynamic exclusion lists and `.pluck`.
The last release (v0.4) didn't add an entry to the changelog. Thus, I
assumed the next release would be v0.3.1, but alas, twas not.
Also I changed the style to the keep-a-changelog format.
A new npm script has been added, `lint`, which is triggered on the test
command after unit tests pass.
This way, greenkeeper can update lint-related deps and know if it
breaks.
Panic-client 0.2 comes with some great new improvements, like supporting back through IE6, making async functions more brief, and preventing implicit
scope injection except under a new flag, '@scope'. This commit updates
the docs to reflect the changes from panic-client, and updates the
client version dependency.
Instead of calling a method to find the length of a list, you can use a
property (which is a getter under the hood, doing the same thing as
`.len()`). This is cleaner and more intuitive, aligning itself more with
arrays.
Subclassing is now facilitated by a new method, `.chain`. It creates a
new list instance by calling the constructor property, instead of
statically creating a new ClientList instance. This allows you to
create subclasses that inherit from ClientList, without losing that
inheritance when calling `.filter` or `.pluck` (methods which create new
list instances).
The client bundle is now exported lazily, so when you import panic,
there's a `client` getter which memoizes a fs call for the client code.
This allows compatibility on pre-3.0 versions of npm, where other packages
might not be able to recursively find `panic-client`. Also, since it's a
getter, it doesn't do the file system call until it's needed.
Instead of calling a method to find the length of a list, you can use a
property (which is a getter under the hood, doing the same thing as
`.len()`). This is cleaner and more intuitive, aligning itself more with
arrays.
Subclassing is now facilitated by a new method, `.chain`. It creates a
new list instance by calling the constructor property, instead of
statically creating a new ClientList instance. This allows you to
create subclasses that inherit from ClientList, without losing that
inheritance when calling `.filter` or `.pluck` (methods which create new
list instances).
The client bundle is now exported lazily, so when you import panic,
there's a `client` getter which memoizes a fs call for the client code.
This allows compatibility on pre-3.0 versions of npm, where other packages
might not be able to recursively find `panic-client`. Also, since it's a
getter, it doesn't do the file system call until it's needed.
Instead of extending the Function's prototype with the `toJSON()`
method, since the `v0.1.0` refactor all functions have a narrow entry
point, meaning you can simply call `String(callback)`. The prototype is
no longer extended. Changelog and package.json updated.
In the async/await section, it wouldn't have been the same without
mentioning our supreme leader Tj Holowaychuk and his co js library.
Basically a syntax sugar using generators over promises. Added a short
demo of how to use it with panic.
There's a new method called `.pluck` that limits a list's length,
allowing you to arbitrarily pick out clients and select them for tasks.
The version has been bumped, changelog updated and readme modified.
Also, the `.excluding` method wasn't reactively checking to see if the
exclusion set was reduced, only added to. All tests passing.
The `panic` object has a new property, `ClientList`, that allows users
to create their own lists easily. It brings in a new feature: you can
pass subgroups into the constructor as an array and it'll source it's
clients from them, allowing groups to be created from smaller
ones. Readme, changelog, npm version, and tests updated.
An example showing how to import code was showing the root route, which
has been deprecated in favor of /panic.js. Some examples were
duplicated, such as how to import client code. Now one simply links to
the other.
`panic.serve` has been replaced with `panic.server`, which accepts
`http.Server` instances instead of options and always returns the
instance. This allows you to run one server and share it, instead of
creating one for each task. Also added a changelog to keep track of...
changes.
Breaks compatibility with `panic.serve`.