meteor-job-collection icon indicating copy to clipboard operation
meteor-job-collection copied to clipboard

Cannot find name "JobCollection"

Open GuofuHuang opened this issue 7 years ago • 4 comments

I just install this package, and I'm using Angular2. But when I start the app, it said that "it cannot find name "JobCollection", anyone knows how to solve it?

GuofuHuang avatar May 04 '17 20:05 GuofuHuang

If it is installed correctly, it should be globally visible. Although depending on your tooling, you may need to import it. I recommend looking at a working sample app if you are just getting started:

https://github.com/vsivsi/meteor-job-collection-playground

https://github.com/vsivsi/meteor-file-job-sample-app

vsivsi avatar May 04 '17 21:05 vsivsi

@GuofuHuang this is typical of an angular2 app and like @vsivsi said you might need to import it. When is it that you see this message? Is it in your editor, when you start your app, in your browsers console? Can you give us some context?

gh0st avatar May 22 '17 21:05 gh0st

@GuofuHuang problem is that typescript is not aware of the package because of a missing type declaration.

declare module 'meteor/vsivsi:job-collection' {
    export class JobCollection {
        constructor( databaseName: string );

        find( query: Object, options?: Object );

        startJobServer();

        allow( options: Object );

        processJobs( type: string, options: Object, worker: ( result: any, callback: any ) => void )
    }

    export class Job {
        constructor( jobCollection: JobCollection, type: string, options: Object );

        priority( priority: string ): Job;

        retry( options: Object ): Job;

        delay( delay: number ): Job;

        save();
    }
}

i never wrote one of those and i'm hoping for some help as well ;)

mibto avatar Jun 09 '17 14:06 mibto

import { JobCollection, Job } from 'meteor/vsivsi:job-collection';

pedrofg avatar Mar 01 '18 15:03 pedrofg