File tree Expand file tree Collapse file tree 3 files changed +18
-12
lines changed
Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " react-retool" ,
3- "version" : " 0.1.9 " ,
3+ "version" : " 0.2.0 " ,
44 "private" : false ,
55 "repository" : {
66 "type" : " git" ,
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ import Retool from './components/Retool'
33
44function App ( ) {
55 return (
6- < Retool url = "https://retoolin.tryretool.com/embedded/public/f7607e1f-670a-4ebf-9a09-be54cf17181e" />
6+ // <Retool/>
7+ < Retool url = "https://retoolin.tryretool.com/embedded/public/f7607e1f-670a-4ebf-9a09-be54cf17181e" > </ Retool >
78 ) ;
89}
910
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ import './retool.css';
44class Retool extends React . Component {
55 constructor ( props ) {
66 super ( props ) ;
7+
8+ if ( ! this . props . url ) throw new Error ( 'Please pass a url into the Retool component.' )
9+
710 this . state = {
811 url : props . url ,
912 elementWatchers : { }
@@ -16,7 +19,9 @@ class Retool extends React.Component {
1619 }
1720
1821 startListening = ( ) => {
19- window . addEventListener ( 'message' , ( e ) => this . handle ( e ) ) ;
22+ if ( this . iframe ) {
23+ window . addEventListener ( 'message' , ( e ) => this . handle ( e ) ) ;
24+ }
2025 }
2126
2227 startWatchers = ( ) => {
@@ -96,15 +101,15 @@ class Retool extends React.Component {
96101
97102 render ( ) {
98103 return (
99- < iframe
100- frameBorder = "none"
101- src = { this . state . url }
102- ref = { e => {
103- this . iframe = e
104- } }
105- >
106- </ iframe >
107- ) ;
104+ < iframe
105+ frameBorder = "none"
106+ src = { this . state . url }
107+ ref = { e => {
108+ this . iframe = e
109+ } }
110+ >
111+ </ iframe >
112+ ) ;
108113 }
109114}
110115
You can’t perform that action at this time.
0 commit comments