@okikio/manager
A superset of the Map class, it extends the Map classes capabilities with awesome new features; it weighs ~325 B (minified and gzipped).
Table of Contents
Getting started
The Manager
class makes Maps easier to use, as well as adding 7 methods, getMap, last, methodCall, add, remove, keys and values, (methodCall is a seperate method from the Manager
class, so treeshaking can get rid of it, if it isn't need).
Note: the behavior of the keys and values methods are slightly modified, to return an Array of keys/values instead of an iterator. You can get the keys and values original effects by using .getMap().keys()
or .getMap().values()
.
Installation
You can install @okikio/manager from npm via npm i @okikio/manager
, pnpm i @okikio/animate
or yarn add @okikio/manager
.
You can use @okikio/manager
on the web via:
Once installed it can be used like this:
import { Manager } from "@okikio/manager";
import { Manager } from "https://unpkg.com/@okikio/manager";
import { Manager } from "https://cdn.jsdelivr.net/npm/@okikio/manager";
import { Manager } from "https://cdn.skypack.dev/@okikio/manager";
<script src="https://unpkg.com/@okikio/manager/lib/api.js"></script>
const { Manager, methodCall } = window.manager;
const { default: Manager, methodCall } = window.manager;
Usage
@okikio/manager
is used the same way Map
is used. Like this,
In typescript
,
import { Manager } from "@okikio/manager";
let elements = new Manager<number, Node>();
let el = document.querySelector(".div");
elements.add(el);
elements.set(1, el.cloneNode());
In javascript
,
import { Manager } from "@okikio/manager";
let elements = new Manager();
let el = document.querySelector(".div");
elements.add(el);
elements.set(1, el.cloneNode());
Read through the API guide to learn more.
Browser & Node Support
Chrome | Edge | Firefox | IE |
---|
> 38 | > 12 | > 13 | > 11 |
Learn about polyfilling, bundling, and more in the platform support guide.
Contributing
If there is something I missed, a mistake, or a feature you would like added please create an issue or a pull request on the beta
branch and I'll try to get to it.
You can try out @okikio/manager
using Gitpod:
Read through the contributing documentation for detailed guides.