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

Introduces a fw.options.fetchHtml() helper. #2723

Merged

Conversation

@andreiglingeanu
Copy link
Collaborator

@andreiglingeanu andreiglingeanu commented Jul 31, 2017

This makes fetching HTML from the backend and rendering option types a breeze. It implements a simple key-value cache for the results and stores them in memory.

Cache can be cleared by demand, when the user of the helper wants to re-fetch every option type.

fw.options.fetchHtml(options, values).then(function (html) {
  console.log(html);
});

fw.options.fetchHtml(options, values).always(function (html) {
  // here, the html variable will sometimes contain error descriptions, right in HTML
  console.log(html);
});

// Cache accessors
fw.options.fetchHtml.getCacheEntryFor(options, values);
fw.options.fetchHtml.emptyCache();

Aside from introducing that helper, this pull request replaces the logic inside fw.OptionsModal() to use that fw.options.fetchHtml service helper.


Documentation

This makes fetching HTML from the backend and rendering option types a
breeze. It implements a simple key-value cache for the results and
stores them in memory. Cache can be cleared by demand, when the user of
the helper wants to re-fetch every option type.

fw.options.fetchHtml(options, values);
fw.options.fetchHtml.getCacheEntryFor(options, values);
fw.options.fetchHtml.emptyCache();
@andreiglingeanu andreiglingeanu merged commit d5327f6 into ThemeFuse:master Jul 31, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant