Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moroboxai/moroboxai-player-react
Embeddable player for running MoroboxAI games in React
https://github.com/moroboxai/moroboxai-player-react
artificial-intelligence library moroboxai react reactjs sandbox typescript
Last synced: about 2 months ago
JSON representation
Embeddable player for running MoroboxAI games in React
- Host: GitHub
- URL: https://github.com/moroboxai/moroboxai-player-react
- Owner: moroboxai
- License: mit
- Created: 2022-04-13T09:41:08.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-11-02T07:32:44.000Z (about 1 year ago)
- Last Synced: 2024-10-31T21:05:31.432Z (2 months ago)
- Topics: artificial-intelligence, library, moroboxai, react, reactjs, sandbox, typescript
- Language: TypeScript
- Homepage:
- Size: 3.17 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# moroboxai-player-react
[![NPM version](https://img.shields.io/npm/v/moroboxai-player-react.svg)](https://www.npmjs.com/package/moroboxai-player-react)
![Node.js CI](https://github.com/moroboxai/moroboxai-player-react/workflows/Node.js%20CI/badge.svg)
[![gitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/moroboxai/moroboxai-player-react/blob/master/LICENSE)
[![Code Quality: Javascript](https://img.shields.io/lgtm/grade/javascript/g/moroboxai/moroboxai-player-react.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/moroboxai/moroboxai-player-react/context:javascript)
[![Total Alerts](https://img.shields.io/lgtm/alerts/g/moroboxai/moroboxai-player-react.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/moroboxai/moroboxai-player-react/alerts)Embeddable player for running [MoroboxAI](https://github.com/moroboxai) games in [React](https://reactjs.org/).
## Installation
Using npm:
```bash
npm install moroboxai-player-react --save
```Or:
```bash
git clone https://github.com/moroboxai/moroboxai-player-react.git
cd moroboxai-player-react
npm i
npm run build
```## Usage
Setup a simple React app with:
```bash
npx create-react-app my-app --template typescript
```Add `moroboxai-player-react` as a dependency:
```bash
cd my-app
npm install moroboxai-player-react --save
```Replace `src/App.tsx` with:
```javascript
import "./App.css";
import Player from "moroboxai-player-react";function App() {
return (
);
}export default App;
```Build and start a local server to see the result:
```bash
npm run build
npm run start
```## Props
| Name | Type | Default | Description |
| :-------- | :------ | :------ | :--------------------------------------------------------------------------------------------------- |
| url | string | | URL of the game |
| splashart | string | | URL of the placeholder image displayed before the game is loaded |
| width | number | | Width of the `div` element |
| height | number | | Height of the `div` element |
| resizable | boolean | true | If the game can resize the player |
| className | string | | Class name for the `div` container |
| autoPlay | boolean | false | Auto play the game after the player is initialized |
| speed | number | 1 | Speed of the game |
| onReady | func | noop | **Signature: function() => void**
Function called when the game is loaded and ready |
| onMount | func | noop | **Signature: function(player: IPlayer) => void**
Function called when the component is mounted |## License
This content is released under the [MIT](http://opensource.org/licenses/MIT) License.