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

JQueryTerminal.pushOptions in TypeScript Doesn't Match the Docs #877

Closed
KiddoV opened this issue Apr 20, 2023 · 4 comments
Closed

JQueryTerminal.pushOptions in TypeScript Doesn't Match the Docs #877

KiddoV opened this issue Apr 20, 2023 · 4 comments
Labels
Bug resolved if issue is resolved, it will be open until merge with master
Milestone

Comments

@KiddoV
Copy link
Contributor

KiddoV commented Apr 20, 2023

Issue summary

The docs:

push([string|function], {object}) — push next interpreter on the stack and call that interpreter. First argument is new interpreter (the same as first argument to terminal). The second argument is a list of options as folow:
    name — to distinguish interpreters using command line history.
    prompt — new prompt for this terminal.
    onExit — callback function called on Exit.
    onStart — callback function called on Start.
    keydown — interpreter keydown event.
    historyFilter — the same as in terminal in next version.
    completion — the same as in terminal.
    login — same as [login](https://terminal.jcubic.pl/api_reference.php#login) main option or calling login method after push.
    keymap — same as [keymap in terminal](https://terminal.jcubic.pl/api_reference.php#terminal_keymap).
    mousewheel — interpreter based mousewheel handler.
    infiniteLogin — if set to true it will ask infinetly for username and password if login is set.
Additionally everything that is passed within the object will be stored with interpreter on the stack — so it can be pop later. See also [Multiple intepreters example](https://terminal.jcubic.pl/examples.php#multiple_interpreters).

TypeScript declaration:

interface JQueryTerminal<TElement = HTMLElement> extends JQuery<TElement> {
    ...
    push(interpreter: TypeOrArray<JQueryTerminal.Interpreter>, options?: JQueryTerminal.pushOptions): JQueryTerminal;
    ...
}

declare namespace JQueryTerminal {
    ...
    type pushOptions = {
        infiniteLogin?: boolean;
        prompt?: ExtendedPrompt;
        login?: LoginArgument;
        name?: string;
        completion?: Completion;
        onExit?: () => void;
        onStart?: () => void;
        mousewheel?: MouseWheelCallback;
    }
    ...
}
@KiddoV KiddoV added the Bug label Apr 20, 2023
@jcubic
Copy link
Owner

jcubic commented Apr 20, 2023

Thanks for the report. There is also a need to check the code since there may be some undocumented options that are supported.

@KiddoV
Copy link
Contributor Author

KiddoV commented Apr 20, 2023

In the meantime. How do I fix it so I can use "keydown" method?

@jcubic
Copy link
Owner

jcubic commented Apr 20, 2023

Sorry, I have no idea, maybe force something into any as a hack.

jcubic added a commit that referenced this issue Apr 20, 2023
@jcubic
Copy link
Owner

jcubic commented Apr 20, 2023

Updated the types for push all terminal events should work with the nested interpreter (added with push) because all of them are triggered with the same function trigger_event, there is also an issue with login events, because onBeforeLogin triggers a global event when using push and local when using automatic login if the token is defined.

Because of this, I didn't include login events in the push options.

@jcubic jcubic added the resolved if issue is resolved, it will be open until merge with master label Apr 20, 2023
@jcubic jcubic added this to the 2.36.0 milestone Apr 20, 2023
@jcubic jcubic closed this as completed May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug resolved if issue is resolved, it will be open until merge with master
Projects
None yet
Development

No branches or pull requests

2 participants