Commit 65a13004 authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau Committed by GitHub

Merge pull request #139 from lshir/nopromise

Remove promise-defer
parents 90095f5b 6c45e6e2
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
"gl-react": "^2.2.4" "gl-react": "^2.2.4"
}, },
"dependencies": { "dependencies": {
"invariant": "2.2.0", "invariant": "2.2.0"
"promise-defer": "1.0.0"
} }
} }
import invariant from "invariant"; import invariant from "invariant";
import React, {Component} from "react"; import React, {Component} from "react";
import {requireNativeComponent, findNodeHandle} from "react-native"; import {requireNativeComponent, findNodeHandle} from "react-native";
import defer from "promise-defer";
import captureFrame from "./GLCanvas.captureFrame"; import captureFrame from "./GLCanvas.captureFrame";
const serializeOption = config => const serializeOption = config =>
...@@ -39,10 +38,20 @@ class GLCanvas extends Component { ...@@ -39,10 +38,20 @@ class GLCanvas extends Component {
const key = serializeOption(config); const key = serializeOption(config);
return this._pendingCaptureFrame[key] || ( return this._pendingCaptureFrame[key] || (
(captureFrame(findNodeHandle(this.refs.native), config), (captureFrame(findNodeHandle(this.refs.native), config),
this._pendingCaptureFrame[key] = defer()) this._pendingCaptureFrame[key] = this._makeDeferred())
); );
} }
_makeDeferred() {
var defer = {};
var p = new Promise(function(resolve, reject) {
defer.resolve = resolve;
defer.reject;
});
defer.promise = p;
return defer;
}
captureFrame (configArg) { captureFrame (configArg) {
let config; let config;
if (configArg) { if (configArg) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment