Skip to content

Commit

Permalink
Fix hashing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpalmer committed Feb 6, 2019
1 parent b91c061 commit 2c03d83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/Script.tsx
@@ -1,9 +1,9 @@
import { createResource } from './createResource';

type ScriptProps = {
src: string;
};
export const ScriptResource = createResource(({ src }: ScriptProps) => {
export interface ScriptProps {
src: HTMLScriptElement['src'];
}
export const ScriptResource = createResource((src: ScriptProps['src']) => {
return new Promise((resolve, reject) => {
const script = document.createElement('script');
script.src = src;
Expand All @@ -16,7 +16,7 @@ export const ScriptResource = createResource(({ src }: ScriptProps) => {
});

export const Script: React.FC<ScriptProps> = ({ children, ...rest }) => {
ScriptResource.read(rest);
ScriptResource.read(rest.src);

if (typeof children === 'function') {
return children();
Expand All @@ -26,5 +26,5 @@ export const Script: React.FC<ScriptProps> = ({ children, ...rest }) => {
};

export function useScript({ src }: ScriptProps) {
return ScriptResource.read({ src });
return ScriptResource.read(src);
}
4 changes: 2 additions & 2 deletions src/Stylesheet.tsx
@@ -1,10 +1,10 @@
import React from 'react';
import { createResource } from './createResource';

type StylesheetProps = {
export interface StylesheetProps {
href: string;
media?: string;
};
}

export const StylesheetResource = createResource(
load,
Expand Down

0 comments on commit 2c03d83

Please sign in to comment.