Skip to content

Commit e38b893

Browse files
committed
Replace es6-promisify with simple polyfill
referto: reactnativecn#37
1 parent 2182364 commit e38b893

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Diff for: index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
*/
44

55
import {NativeModules, NativeAppEventEmitter} from 'react-native';
6-
import promisify from 'es6-promisify';
76

87
const {WeiboAPI} = NativeModules;
98

9+
function promisify(fn, handler) {
10+
return function (...args) {
11+
return new Promise(function (resolve, reject) {
12+
fn(...args, handler.bind({ resolve, reject }))
13+
})
14+
}
15+
}
16+
1017
// Used only with promisify. Transform callback to promise result.
1118
function translateError(err, result) {
1219
if (!err) {

Diff for: package.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,5 @@
2424
"bugs": {
2525
"url": "https://github.com/reactnativecn/react-native-weibo/issues"
2626
},
27-
"homepage": "https://github.com/reactnativecn/react-native-weibo#readme",
28-
"dependencies": {
29-
"es6-promisify": "^3.0.0"
30-
}
27+
"homepage": "https://github.com/reactnativecn/react-native-weibo#readme"
3128
}

0 commit comments

Comments
 (0)