@latel88/job
v1.2.13
Published
## how to use - install ```shell npm install @latel88/job ``` ``` - CJS ```javascript const { Job, Child, Collection } = require( "@latel88/job" ).default; ``` - ESM ```javascript import { Job, Child, Collection } from "@latel88/job"; ```
Downloads
129
Readme
Job
how to use
- install
npm install @latel88/job
- CJS
```javascript
const { Job, Child, Collection } = require( "@latel88/job" ).default;
- ESM
import { Job, Child, Collection } from "@latel88/job";
exsample
- extend
class Entity extends Job
{
constructor ()
{
super( "enemy" );
}
};
const entity = new Entity();
entity.begin();
getFile( () =>
{
entity.done();
} );
const id = setInterval( () =>
{
if (entity.hasComplete())
{
callback();
clearInterval( id );
}
else
{
if (hasError())
{
entity.skip();
}
else
{
sleep();
}
}
} );
class Entity extends Child
{
constructor ()
{
super( "child#enemy.entity" );//css query selector
}
};
const collection = new Collection();
const entity = new Entity();
collection.set( entity );
collection.find( ".entity" );