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

Change parameter positions for add / remove listener #4237

Closed
vanniktech opened this issue Jun 6, 2023 · 1 comment · Fixed by #4244
Closed

Change parameter positions for add / remove listener #4237

vanniktech opened this issue Jun 6, 2023 · 1 comment · Fixed by #4244
Labels

Comments

@vanniktech
Copy link
Contributor

Description

-fun addListener(listener: Query.Listener, queryKeys: Array<String>)
+fun addListener(queryKeys: Array<String>, listener: Query.Listener)
-fun removeListener(listener: Query.Listener, queryKeys: Array<String>)
+fun removeListener(queryKeys: Array<String>, listener: Query.Listener)

That way one could make use of the fun interface:

  fun interface Listener {
    /**
     * Called whenever the query this listener was attached to is dirtied.
     *
     * Calls are made synchronously on the thread where the updated occurred, after the update applied successfully.
     */
    fun queryResultsChanged()
  }

since the lambda function would be last.

@hfhbd
Copy link
Collaborator

hfhbd commented Jun 7, 2023

I would also change queryKeys: Array<String> to vararg queryKeys: String.

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

Successfully merging a pull request may close this issue.

2 participants