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

Add ChangeToken static methods to Primitives #62

Closed
rynowak opened this issue Nov 3, 2015 · 1 comment
Closed

Add ChangeToken static methods to Primitives #62

rynowak opened this issue Nov 3, 2015 · 1 comment
Assignees
Milestone

Comments

@rynowak
Copy link
Member

rynowak commented Nov 3, 2015

We want to add these boilerplate combinators for IChangeToken

public static class ChangeToken
{
    public static void OnChange(Func<IChangeToken> changeTokenProducer, Action changeTokenConsumer)
    {
        Action<object> callback = null;
        callback = (s) => 
        {
            var token = changeTokenProducer();
            changeTokenConsumer();
            token.Register(callback, null);
        }

        token.Register(callback, null);
    }

    public static void OnChange<T>(Func<IChangeToken> changeTokenProducer, Action<T> changeTokenConsumer, T state)
    {
        Action<object> callback = null;
        callback = (s) => 
        {
            var token = changeTokenProducer();
            changeTokenConsumer((T)s);
            token.Register(callback, s);
        }

        token.Register(callback, state);
    }
}
@HaoK HaoK self-assigned this Nov 12, 2015
@HaoK HaoK added this to the 1.0.0-rc2 milestone Nov 12, 2015
@HaoK
Copy link
Member

HaoK commented Nov 12, 2015

01eff58

@HaoK HaoK closed this as completed Nov 12, 2015
natemcmaster pushed a commit that referenced this issue Oct 24, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Dec 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants