import Client from "./client" ; import { AsyncResult } from "./result" ; export default class Task { client : Client ; name : string ; constructor param { Client } clinet param { string } name constructor ( client , name ) { this . client = client ; this . name = name ; } method returns { AsyncResult } example public delay ( ... args ) { return this . applyAsync ( [ ... args ] ) ; } public applyAsync ( args , kwargs ? ) { if ( args && ! Array . isArray ( args ) ) { throw new Error ( "args is not array" ) ; } if ( kwargs && typeof kwargs !== "object" ) { throw new Error ( "kwargs is not object" ) ; } return this . client . sendTask ( this . name , args || [ ] , kwargs || { } ) ; } }