This repository has been archived by the owner on Apr 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ddc435
commit 0ac61a4
Showing
2 changed files
with
15 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
import {NativeModules} from "react-native"; | ||
import Swagger from "swagger-client"; | ||
import spec from "./spec.json"; | ||
var {NativeModules} = require('react-native'); | ||
var Couchbase = NativeModules.ReactCBLite; | ||
|
||
const ReactCBLite = NativeModules.ReactCBLite; | ||
var Swagger = require('swagger-client'); | ||
var spec = require('./spec.json'); | ||
|
||
let manager, callback; | ||
|
||
ReactCBLite.init(url => { | ||
var manager, callback; | ||
Couchbase.init(url => { | ||
spec.host = url.split('/')[2]; | ||
|
||
new Swagger({spec: spec, usePromise: true}) | ||
new Swagger({ spec: spec, usePromise: true }) | ||
.then(client => { | ||
manager = client; | ||
if (typeof callback == 'function') { | ||
if(typeof callback == 'function'){ | ||
callback(manager); | ||
} | ||
}); | ||
}); | ||
|
||
const rncblite = function (cb) { | ||
if (typeof manager !== 'undefined') { | ||
cb(manager); // If manager is already defined then don't wait | ||
Couchbase.initRESTClient = function(cb){ | ||
if(typeof foo != 'undefined'){ | ||
cb(manager); // If manager is already define, don't wait. | ||
} else { | ||
callback = cb; | ||
} | ||
}; | ||
|
||
module.exports = {rncblite, ReactCBLite}; | ||
module.exports = Couchbase; |
0ac61a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi james - you backed out my change here, was the intentional? I think
if(typeof foo != 'undefined'){
should read
if (typeof manager !== 'undefined') {
[edit] - ah looks like all my changes have gone.