Giter VIP home page Giter VIP logo

Comments (7)

machty avatar machty commented on May 19, 2024 1

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.

from ember-concurrency.

sarjanen avatar sarjanen commented on May 19, 2024

Would be nice, status on this?

from ember-concurrency.

machty avatar machty commented on May 19, 2024

@Padchi still thinking through some ideas about whether this should be task-helper specific or whether in JS it should be easy to create tasks that are curried versions of other tasks.

from ember-concurrency.

sarjanen avatar sarjanen commented on May 19, 2024

I don't think this was my problem tho. I just want to pass down a task to a component, perform it from the component and be able to to see if it's running or not. Maybe I'm doing something wrong but isRunning is undefined:

// template 
{{search-input on-input=(perform search)}}

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

Skickat från min iPhone

20 mars 2016 kl. 05:59 skrev Alex Matchneer [email protected]:

@Padchi still thinking through some ideas about whether this should be task-helper specific or whether in JS it should be easy to create tasks that are curried versions of other tasks.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

from ember-concurrency.

sarjanen avatar sarjanen commented on May 19, 2024

Well that work's except that the value that is passed to the task is the whole oninput event:
Event {isTrusted: true, type: "input", target: input, currentTarget: input, eventPhase: 2…}

from ember-concurrency.

machty avatar machty commented on May 19, 2024

@Padchi I believe that's fixed on master but I still need to cut a release :/ will try and get that out soon.

from ember-concurrency.

machty avatar machty commented on May 19, 2024

(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

from ember-concurrency.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.