From af51675279ce0260788e38e235ced2db713ec9ac Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Sat, 31 Jan 2015 17:57:42 -0200 Subject: [PATCH] add prop onError to handle request errors --- README.md | 16 +++++++- bower.json | 2 +- dist/react-video.css | 2 +- dist/react-video.js | 80 +++++++++++++++++++++++----------------- dist/react-video.min.css | 2 +- dist/react-video.min.js | 4 +- docs/index.html | 14 +++++++ lib/react-video.jsx | 37 +++++++++++-------- package.json | 2 +- utils/ajax.js | 33 ++++++++++------- 10 files changed, 124 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index c4d9009..779221c 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Installing this component is very easy and it has just one dependency: [React](h $ bower install --save react-video ``` -- Or if you want to [download the lastest release](https://github.com/pedronauck/react-video/archive/v1.4.0.zip) and put in your website, it will work too! +- Or if you want to [download the lastest release](https://github.com/pedronauck/react-video/archive/v1.5.0.zip) and put in your website, it will work too! **NOTICE:** You need just one thing to make the component work. Put the [base component style](./dist/react-video.css) at the `
` tag. If you don't wanna use the `.css` extension, you can get the `.styl` or `.scss` extension at the folder `./lib`. @@ -55,6 +55,19 @@ The property `videoId` is optional, so you can use it or not. If you don't pass ); ``` +To handle errors when something happens, like your video can't be loaded, you can pass a callback with a prop `onError` in the component: + +```javascript + var _onError = function(err) { + console.log(err); + }; + + React.render( +