question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

add (task) helper to pass in curried tasks

See original GitHub issue

Presently the perform template helper essentially produces a closure action so that you can pass a task (w curried args) into a component and have it be invoked upon sendAction or this.attrs.actionName(). It seems desirable to be able to pass in a Task with curried args so that there’s feature parity w closure actions, and components maintain the ability to stylize themselves according to the isRunning state of the task.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
machtycommented, Mar 31, 2016

I think this is what you want (though you might want to rename some things):

// template
{{search-input on-input=search}}

// component
<input type="text" value={{query}} oninput={{perform on-input value="target.value"}}>
{{if (get on-input 'isRunning') "never true"}}

The perform helper produces a regular ol function that’s compatible with APIs expecting you to pass in closure actions / functions. The way you had it, you were basically doing a lookup of isRunning on a function, rather than a task. If you’re writing a component that is task-aware, you can just pass in the task directly, and then call perform on the task from within the component’s template.

0reactions
machtycommented, Apr 1, 2016

(task) has now been implemented and released in 0.6.0, as is support for value="..."; there is an example for value=“” at the bottom of http://ember-concurrency.com/#/docs/writing-tasks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Curry and Function Composition - Medium
So what we'll need to do instead is call a function that returns a function. Create a function that increments whatever number you...
Read more >
Understanding JavaScript currying - LogRocket Blog
In this example, we are going to create a simple curry function where a user sends a friend request to his friend John:...
Read more >
Add or edit a task - Android - Google Tasks Help
Create a task · Open the Google Tasks app Tasks . · Tap Add task . · Enter a title. · Optional: To...
Read more >
Make a To-Do List That Works: The Right Way to Get Sh!t Done
Some people might find that adding different colors for different types of tasks might help the routine stick. Others go the whiteboard or ......
Read more >
Create tasks and to-do items - Microsoft Support
Select New Items > Task or press Ctrl+Shift+K. In the Subject box, enter a name for the task. It's best to keep the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found