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

Note about storing instances of objects #16

Closed
reggi opened this issue Feb 4, 2019 · 0 comments
Closed

Note about storing instances of objects #16

reggi opened this issue Feb 4, 2019 · 0 comments

Comments

@reggi
Copy link

reggi commented Feb 4, 2019

async function fun(a) {
  return new Hello(a);
}

async function fun_(a) {
  return memoize.fn(fun, {}).then((memFn) => {
    return memFn(a);
  });
}

fun('meow').then(console.log);
fun_('meow').then(console.log);

First time this runs:

Hello { sound: 'meow' }
Hello { sound: 'meow' }

Second time this runs:

Hello { sound: 'meow' }
{ sound: 'meow' }
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

1 participant