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

Enable buffer methods before needing to call StyleSheetServer.renderStatic #342

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Correct comment in regards to new methods, removing wrongly applied f…
…ormatting
  • Loading branch information
DaBs committed Aug 31, 2018
commit c44154b4a406e2d67cbba758307ca941c855e2f4
13 changes: 6 additions & 7 deletions src/exports.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* @flow */
import { hashString } from './util';
import {hashString} from './util';
import {
injectAndGetClassName,
reset,
@@ -10,7 +10,7 @@ import {
getRenderedClassNames,
getBufferedStyles,
} from './inject';
import { defaultSelectorHandlers } from './generate';
import {defaultSelectorHandlers} from './generate';

/* ::
import type { SelectorHandler } from './generate.js';
@@ -56,7 +56,7 @@ const StyleSheet = {
return mappedSheetDefinition;
},

rehydrate(renderedClassNames /* : string[] */ = []) {
rehydrate(renderedClassNames /* : string[] */ =[]) {
addRenderedClassNames(renderedClassNames);
},
};
@@ -91,9 +91,8 @@ const StyleSheetServer = typeof window !== 'undefined'
/**
* Prevent styles from being injected into the DOM.
*
* This is useful in situations where you'd like to test rendering UI
* components which use Aphrodite without any of the side-effects of
* Aphrodite happening.
* This is useful in situations where you do not have an available DOM
* but are still considering walking the tree without calling a renderFunc
*
* Should be paired with a subsequent call to
* clearBufferAndResumeStyleInjection.
@@ -104,7 +103,7 @@ const StyleSheetServer = typeof window !== 'undefined'
},

/**
* Opposite method of preventStyleInject.
* Opposite method of suppressStyleInjection.
*/
clearBufferAndResumeStyleInjection() {
reset();
9 changes: 4 additions & 5 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
@@ -33,12 +33,12 @@ export interface StyleSheetStatic {
*/
create<T extends StyleDeclaration<T>>(
styles: T
): { [K in keyof T]: StyleDeclarationValue };
): {[K in keyof T]: StyleDeclarationValue };
/**
* Rehydrate class names from server renderer
*/
rehydrate(renderedClassNames: string[]): void;

extend(extensions: Extension[]): Exports;
}

@@ -71,9 +71,8 @@ interface StyleSheetServerStatic {
/**
* Prevent styles from being injected into the DOM.
*
* This is useful in situations where you'd like to test rendering UI
* components which use Aphrodite without any of the side-effects of
* Aphrodite happening.
* This is useful in situations where you do not have an available DOM
* but are still considering walking the tree without calling a renderFunc
*
* Should be paired with a subsequent call to
* clearBufferAndResumeStyleInjection.