react-cron-jobs
Version:
React UI to build cron expressions
52 lines (40 loc) • 1.41 kB
Markdown
React UI component to create cron expression.
```` bash
npm install --save react-cron-jobs
````
<a href="https://codesandbox.io/s/react-cron-jobs-demo-lzxwn" target="_blank"> Live demo </a>
```javascript
import React from 'react';
import './App.css';
import CronJob from 'react-cron-jobs';
class App extends React.Component {
myCallBackFunc(cronExp, scheduleName) {
console.log('Cron expression for schedule ' + scheduleName + ' is ' + cronExp);
}
render () {
return(
<div>
<CronJob
getCronExpression={this.myCallBackFunc}
jobName={'applicationBackup'}>
</CronJob>
</div>
);
}
}
export default App;
```
| Prop | Type | Description |
|-------------------|------------|-------------|
| `getCronExpression` | _function_ | Use this callback function to receive the cron expression for the schedule configured. |
| `jobName` | _string_ | Pass this prop to get the name of the job in the callback function passed as props |
| `frequency` | _string_ | Pass this prop along with prop 'cronString' to load the cronjob UI with this frequency and highlight the selected values |
| `cronString` | _string_ | Pass this prop along with prop 'frequency' to load the cronjob UI with this cronString and highlight the selected values |
---
MIT