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

Catch an error action #32

Open
allinne opened this issue Dec 5, 2018 · 2 comments
Open

Catch an error action #32

allinne opened this issue Dec 5, 2018 · 2 comments

Comments

@allinne
Copy link

allinne commented Dec 5, 2018

Hi!
Is there possibility to catch an event when an error appears?
For example, a user types a wrong style name and ace-editor shows an error icon. Does ember-ace fire an action for this?

@Frozenfire92
Copy link

you can use the ready action

<EmberAce @ready={{this.watchForErrors}} />
@action watchForErrors(editor: any) {
    editor.getSession().on('change', (_event: any, session: any) => {
      // seems there is a delay between annotations and the change event
      later(() => {
        this.editorErrors = session.getAnnotations().filterBy('type', 'error');
      }, 750);
    });
  }

@aalimovs
Copy link

FYI, you can use changeAnnotation event instead of the change and drop the 750ms delay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants