Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Access app states + decorator in the cron handler #30

Open
KONFeature opened this issue Oct 8, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@KONFeature
Copy link

What is the problem this feature would solve?

Would be awesome to have access to the current instance sstore + decorators in the cron handler.

As of right now, I'm using smth like this to retrieve params from decorators / store :

const baseApp = new Elysia().decorate({someStuff: "test"})

export const demoCron = (app: typeof baseApp) => app.use(
    cron({
        name: "demo",
        pattern: Patterns.everyMinutes(30),
        run: async () => {
            // Get some stuff from the app
            const {
                someStuff
            } = app.decorator;
        },
    })
)

Not a huge fan of this design (but it's working)
I've tried a few different way to "correct" this, by implementing custom cron, with custom generics etc, but tbh I'm new to Elysia and a bit lost in it's types ahah

What is the feature you are proposing to solve the problem?

Updating the cron run method of the cron plugin, to accept the current Elysia instance store + decorators as params

What alternatives have you considered?

No response

@KONFeature KONFeature added the enhancement New feature or request label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant