Files: 8461f5116e38210324ed4dfd92a4b8fae57407d9 / modules_extra / blob.js
509 bytesRaw
1 | const fs = require('fs') |
2 | const h = require('../h') |
3 | const ref = require('ssb-ref') |
4 | |
5 | exports.needs = { |
6 | blob_url: 'first' |
7 | } |
8 | |
9 | exports.gives = { |
10 | 'screen_view': true, |
11 | 'mcss': true |
12 | } |
13 | |
14 | exports.create = (api) => { |
15 | return { |
16 | screen_view, |
17 | mcss: () => fs.readFileSync(__filename.replace(/js$/, 'mcss'), 'utf8') |
18 | } |
19 | |
20 | function screen_view (path) { |
21 | if(!ref.isBlob(path)) return |
22 | |
23 | return h('Blob', [ |
24 | h('iframe', { |
25 | src: api.blob_url(path), |
26 | sandbox: '' |
27 | }) |
28 | ]) |
29 | } |
30 | } |
31 | |
32 |
Built with git-ssb-web