mirror of
https://github.com/hydra-synth/hydra.git
synced 2025-12-21 22:29:58 +01:00
save code and image
This commit is contained in:
@@ -47284,6 +47284,19 @@ module.exports = function store(state, emitter) {
|
||||
|
||||
emitter.on('screencap', () => {
|
||||
screencap()
|
||||
const editor = state.editor.editor
|
||||
const text = editor.getValue()
|
||||
const data = new Blob([text], {type: 'text/plain'});
|
||||
const a = document.createElement('a')
|
||||
a.style.display = 'none'
|
||||
let d = new Date()
|
||||
a.download = `hydra-${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}-${d.getHours()}.${d.getMinutes()}.${d.getSeconds()}.js`
|
||||
a.href = URL.createObjectURL(data)
|
||||
a.click()
|
||||
|
||||
setTimeout(() => {
|
||||
window.URL.revokeObjectURL(a.href);
|
||||
}, 300);
|
||||
})
|
||||
|
||||
emitter.on('editor:randomize', function (evt) {
|
||||
|
||||
@@ -53,6 +53,19 @@ module.exports = function store(state, emitter) {
|
||||
|
||||
emitter.on('screencap', () => {
|
||||
screencap()
|
||||
const editor = state.editor.editor
|
||||
const text = editor.getValue()
|
||||
const data = new Blob([text], {type: 'text/plain'});
|
||||
const a = document.createElement('a')
|
||||
a.style.display = 'none'
|
||||
let d = new Date()
|
||||
a.download = `hydra-${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}-${d.getHours()}.${d.getMinutes()}.${d.getSeconds()}.js`
|
||||
a.href = URL.createObjectURL(data)
|
||||
a.click()
|
||||
|
||||
setTimeout(() => {
|
||||
window.URL.revokeObjectURL(a.href);
|
||||
}, 300);
|
||||
})
|
||||
|
||||
emitter.on('editor:randomize', function (evt) {
|
||||
|
||||
Reference in New Issue
Block a user