react-google-calendar-api
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "react-google-calendar-api", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "An api to manage your google calendar", | ||
@@ -5,0 +5,0 @@ "main": "ApiCalendar.js", |
@@ -49,2 +49,39 @@ ![alt](https://kitn.net/wp-content/uploads/2016/09/google-calendar-logo.jpg) | ||
``` | ||
#### Example | ||
```javascript | ||
import React, {ReactNode, SyntheticEvent} from 'react'; | ||
import ApiCalendar from 'react-google-calendar-api'; | ||
export default class DoubleButton extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.handleItemClick = this.handleItemClick.bind(this); | ||
} | ||
public handleItemClick(event: SyntheticEvent<any>, name: string): void { | ||
if (name === 'sign-in') { | ||
ApiCalendar.handleAuthClick(); | ||
} else if (name === 'sign-out') { | ||
ApiCalendar.handleSignoutClick(); | ||
} | ||
} | ||
render(): ReactNode { | ||
return ( | ||
<button | ||
onClick={(e) => this.handleItemClick(e, 'sign-in')} | ||
> | ||
sign-in | ||
</button> | ||
<button | ||
onClick={(e) => this.handleItemClick(e, 'sign-out')} | ||
> | ||
sign-out | ||
</button> | ||
); | ||
} | ||
} | ||
``` | ||
@@ -88,2 +125,20 @@ ### setCalendar: | ||
public createEventFromNow({time, summary, description = ''}: any, calendarId: string = this.calendar): any | ||
``` | ||
#### Example | ||
```javascript | ||
import ApiCalendar from 'react-google-calendar-api'; | ||
const eventFromNow: object = { | ||
summary: "Poc Dev From Now", | ||
time: 480, | ||
}; | ||
ApiCalendar.createEventFromNow(eventFromNow) | ||
.then((result: object) => { | ||
console.log(result); | ||
}) | ||
.catch((error: any) => { | ||
console.log(error); | ||
}); | ||
``` | ||
@@ -103,2 +158,14 @@ | ||
#### Example | ||
```javascript | ||
import ApiCalendar from 'react-google-calendar-api'; | ||
if (ApiCalendar.sign) | ||
ApiCalendar.listUpcomingEvents(10) | ||
.then(({result}: any) => { | ||
console.log(result.items); | ||
}); | ||
``` | ||
## Utils | ||
@@ -125,1 +192,33 @@ | ||
``` | ||
#### Example | ||
```javascript | ||
import React, {ReactNode} from 'react'; | ||
import ApiCalendar from 'react-google-calendar-api'; | ||
export default class StatusSign extends React.Component<any, any> { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
sign: ApiCalendar.sign, | ||
}; | ||
this.signUpdate = this.signUpdate.bind(this); | ||
ApiCalendar.onLoad(() => { | ||
ApiCalendar.listenSign(this.signUpdate); | ||
}); | ||
} | ||
public signUpdate(sign: boolean): any { | ||
this.setState({ | ||
sign | ||
}) | ||
} | ||
render(): ReactNode { | ||
return ( | ||
<div>{this.state.sign}</div> | ||
); | ||
} | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18612
221