mirror of https://github.com/embarklabs/embark.git
Fixing some logic on Embark.Storage.setProvider
This commit is contained in:
parent
3a50dbdfdd
commit
f1b8438cbb
|
@ -2,48 +2,74 @@ var EmbarkJS =
|
|||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId])
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
|
||||
/******/
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ exports: {},
|
||||
/******/ id: moduleId,
|
||||
/******/ loaded: false
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.loaded = true;
|
||||
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
|
||||
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
|
||||
/******/
|
||||
/******/ // identity function for calling harmony imports with the correct context
|
||||
/******/ __webpack_require__.i = function(value) { return value; };
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(0);
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
//var Ipfs = require('./ipfs.js');
|
||||
|
@ -184,13 +210,15 @@ var EmbarkJS =
|
|||
return promise;
|
||||
};
|
||||
|
||||
EmbarkJS.IPFS = 'ipfs';
|
||||
|
||||
EmbarkJS.Storage = {
|
||||
IPFS : 'ipfs'
|
||||
};
|
||||
|
||||
EmbarkJS.Storage.setProvider = function(provider, options) {
|
||||
if (provider === 'ipfs') {
|
||||
if (provider.toLowerCase() === EmbarkJS.Storage.IPFS) {
|
||||
//I don't think currentStorage is used anywhere, this might not be needed
|
||||
//for now until additional storage providers are supported. But keeping it
|
||||
//anyways
|
||||
this.currentStorage = EmbarkJS.Storage.IPFS;
|
||||
if (options === undefined) {
|
||||
this.ipfsConnection = IpfsApi('localhost', '5001');
|
||||
|
@ -198,7 +226,7 @@ var EmbarkJS =
|
|||
this.ipfsConnection = IpfsApi(options.server, options.port);
|
||||
}
|
||||
} else {
|
||||
throw Error('unknown provider');
|
||||
throw Error('Unknown storage provider');
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -493,5 +521,5 @@ var EmbarkJS =
|
|||
module.exports = EmbarkJS;
|
||||
|
||||
|
||||
/***/ }
|
||||
/***/ })
|
||||
/******/ ]);
|
10
js/embark.js
10
js/embark.js
|
@ -137,13 +137,15 @@ EmbarkJS.Contract.prototype.deploy = function(args, _options) {
|
|||
return promise;
|
||||
};
|
||||
|
||||
EmbarkJS.IPFS = 'ipfs';
|
||||
|
||||
EmbarkJS.Storage = {
|
||||
IPFS : 'ipfs'
|
||||
};
|
||||
|
||||
EmbarkJS.Storage.setProvider = function(provider, options) {
|
||||
if (provider === 'ipfs') {
|
||||
if (provider.toLowerCase() === EmbarkJS.Storage.IPFS) {
|
||||
//I don't think currentStorage is used anywhere, this might not be needed
|
||||
//for now until additional storage providers are supported. But keeping it
|
||||
//anyways
|
||||
this.currentStorage = EmbarkJS.Storage.IPFS;
|
||||
if (options === undefined) {
|
||||
this.ipfsConnection = IpfsApi('localhost', '5001');
|
||||
|
@ -151,7 +153,7 @@ EmbarkJS.Storage.setProvider = function(provider, options) {
|
|||
this.ipfsConnection = IpfsApi(options.server, options.port);
|
||||
}
|
||||
} else {
|
||||
throw Error('unknown provider');
|
||||
throw Error('Unknown storage provider');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue