add storage plugin

pull/5370/head
filip mertens 3 years ago
parent 9a3b8fe129
commit 734d4f7d23
  1. 7
      apps/remix-ide/src/app.js
  2. 24
      apps/remix-ide/src/app/plugins/storage.ts
  3. 2
      apps/remix-ide/src/remixAppManager.js

@ -18,6 +18,7 @@ import { OffsetToLineColumnConverter, CompilerMetadata, CompilerArtefacts, Fetch
import Registry from './app/state/registry'
import { ConfigPlugin } from './app/plugins/config'
import { StoragePlugin } from './app/plugins/storage'
import { Layout } from './app/panels/layout'
import { NotificationPlugin } from './app/plugins/notification'
import { Blockchain } from './blockchain/blockchain.js'
@ -142,6 +143,9 @@ class AppComponent {
// ----------------- dGit provider ---------------------------------
const dGitProvider = new DGitProvider()
// ----------------- Storage plugin ---------------------------------
const storagePlugin = new StoragePlugin()
// ----------------- import content service ------------------------
const contentImport = new CompilerImports()
@ -214,6 +218,7 @@ class AppComponent {
web3Provider,
fetchAndCompile,
dGitProvider,
storagePlugin,
hardhatProvider,
self.walkthroughService
])
@ -327,7 +332,7 @@ class AppComponent {
await self.appManager.activatePlugin(['settings', 'config'])
await self.appManager.activatePlugin(['hiddenPanel', 'pluginManager', 'contextualListener', 'terminal', 'blockchain', 'fetchAndCompile', 'contentImport', 'gistHandler'])
await self.appManager.activatePlugin(['settings'])
await self.appManager.activatePlugin(['walkthrough'])
await self.appManager.activatePlugin(['walkthrough','storage'])
self.appManager.on(
'filePanel',

@ -0,0 +1,24 @@
import { Plugin } from '@remixproject/engine';
const profile = {
name: 'storage',
displayName: 'Storage',
description: 'Storage',
methods: ['getStorage']
};
export class StoragePlugin extends Plugin {
constructor() {
console.log('storage plugin')
super(profile);
}
async getStorage() {
console.log('getStorage')
if ('storage' in navigator && 'estimate' in navigator.storage) {
return navigator.storage.estimate()
} else {
throw new Error("Can't get storage quota");
}
}
}

@ -8,7 +8,7 @@ const _paq = window._paq = window._paq || []
const requiredModules = [ // services + layout views + system views
'manager', 'config', 'compilerArtefacts', 'compilerMetadata', 'contextualListener', 'editor', 'offsetToLineColumnConverter', 'network', 'theme',
'fileManager', 'contentImport', 'blockchain', 'web3Provider', 'scriptRunner', 'fetchAndCompile', 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons',
'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity-logic', 'gistHandler', 'layout', 'notification', 'permissionhandler', 'walkthrough']
'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity-logic', 'gistHandler', 'layout', 'notification', 'permissionhandler', 'walkthrough', 'storage']
const dependentModules = ['git', 'hardhat', 'slither'] // module which shouldn't be manually activated (e.g git is activated by remixd)

Loading…
Cancel
Save