2.2.0 • Published 5 years ago

@cncta/util v2.2.0

Weekly downloads
10
License
MIT
Repository
-
Last release
5 years ago

@cncta/util Helpful utils

Patcher

Add a \$Id to every WorldObjectNPCBase

const WorldObjectNPCBase = new ClientLibPatch<PatchedId>('ClientLib.Data.WorldSector.WorldObjectNPCBase');
WorldObjectNPCBase.addGetter('$Id', '$ctor', /\&.*=-1;\}this\.([A-Z]{6})=\(/);

ClientLibLoader

Wait for ClientLib to be loaded

import { ClientLibLoader } from '@cncta/util';

while (!ClientLibLoader.isLoaded) {
    await sleep(100);
}

LocalStorage Cache

World isolated localstorage cache, adds world information to the cache key

import { LocalCache, Duration } from '@cncta/util';

LocalCache.set('foo', 'bar'); // Stores "st-<worldId>-foo" => "bar"

const item = LocalCache.get('foo');

// Only get "foo" if it was last set within 5 days
const item = LocalCache.get('foo', Duration.day(5));
2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago

0.10.0

5 years ago

0.10.1

5 years ago

0.9.0

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago