File tree 2 files changed +9
-5
lines changed
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 3
3
*/
4
4
5
5
import { NativeModules , NativeAppEventEmitter } from 'react-native' ;
6
- import promisify from 'es6-promisify' ;
7
6
8
7
const { WeiboAPI} = NativeModules ;
9
8
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
+
10
17
// Used only with promisify. Transform callback to promise result.
11
18
function translateError ( err , result ) {
12
19
if ( ! err ) {
Original file line number Diff line number Diff line change 24
24
"bugs" : {
25
25
"url" : " https://github.com/reactnativecn/react-native-weibo/issues"
26
26
},
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"
31
28
}
You can’t perform that action at this time.
0 commit comments