imobile_for_javascript
Version:
iMobile for JavaScript,是SuperMap iMobile推出的一款基于React-Native框架的移动应用开发工具。基于该开发工具,用户可以使用JavaScript开发语言,开发出在Android和IOS操作系统下运行的原生移动GIS应用,入门门槛低,一次开发,处处运行。
54 lines (49 loc) • 1.56 kB
JavaScript
/**
* Created by will on 2016/6/17.
*/
import {NativeModules} from 'react-native';
let D = NativeModules.JSDatasources;
import Datasource from './Datasource.js';
/**
* @deprecated
* @class Datasources
*/
export default class Datasources{
/**
* @memberOf Datasources
* @param datasourceConnectionInfo
* @returns {Promise.<Datasource>}
*/
async open(datasourceConnectionInfo){
this._drepecated();
try{
var {datasourceId} = await D.open(this.datasourcesId,datasourceConnectionInfo.datasourceConnectionInfoId);
console.log("datasourceId:"+datasourceId);
var datasource = new Datasource();
datasource.datasourceId = datasourceId;
return datasource;
}catch(e){
console.error(e);
}
}
async get(index){
this._drepecated();
try{
var datasource = new Datasource();
if(typeof index != 'string'){
var {datasourceId} = await D.get(this.datasourcesId,index);
}else{
var {datasourceId} = await D.getByName(this.datasourcesId,index);
}
datasource.datasourceId = datasourceId;
return datasource;
}catch(e){
console.error(e);
}
}
_drepecated(){
console.warn("Datasources.js:This class has been deprecated. " +
"All its implements has been migrated to the Workspace class." +
"Relevant modifications refer to the API documents please");
}
}