Document getSlotFragments

This commit is contained in:
Chi Vinh Le
2017-04-26 01:58:07 +07:00
parent eb9846ba40
commit cb5228a423
+10 -1
View File
@@ -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)) {