From cb5228a423cb6750bae14a41ba11de4b28e4764a Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Wed, 26 Apr 2017 01:58:07 +0700 Subject: [PATCH] Document getSlotFragments --- client/coral-framework/helpers/plugins.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/coral-framework/helpers/plugins.js b/client/coral-framework/helpers/plugins.js index 9961ea54e..df50fdcb7 100644 --- a/client/coral-framework/helpers/plugins.js +++ b/client/coral-framework/helpers/plugins.js @@ -41,7 +41,16 @@ function getComponentFragments(components) { } /** - * @returns {[key]: {spreads: string, definitions: AST}} + * Returns an object that can be used to compose fragments or queries. + * + * Example: + * const pluginFragments = getSlotsFragments(['commentInfoBar', 'commentDetail']); + * const rootFragment = gql` + * fragment Comment_root on RootQuery { + + ${pluginFragments.spreads('root')} + * } + * ${pluginFragments.definitions('root')} + * `; */ export function getSlotsFragments(slots) { if (!Array.isArray(slots)) {