1
0
mirror of https://github.com/fuse-friends/fuse-native synced 2024-10-27 18:34:01 +00:00

cleanup js

This commit is contained in:
Mathias Buus 2019-07-25 12:37:14 +02:00
parent cf9234e856
commit 48d991ac79

View File

@ -4,43 +4,30 @@ console.log(binding)
class Fuse {
constructor () {
this.fuseThread = Buffer.alloc(binding.sizeof_fuse_thread_t)
this._thread = Buffer.alloc(binding.sizeof_fuse_thread_t)
}
mount (mnt) {
binding.fuse_native_mount('mnt', '-odebug', data, this, on_op)
binding.fuse_native_mount(mnt, '-odebug', this._thread, this, this.onop)
}
onop (handle) {
console.log('on_op is called', handle)
process.nextTick(function () {
binding.fuse_native_signal(handle)
})
}
}
const ctx = {}
const data = Buffer.alloc(binding.sizeof_fuse_thread_t)
let buffers = []
let foo
const f = new Fuse()
binding.fuse_native_mount('mnt', '-odebug', data, ctx, on_op)
let to = 1
setTimeout(function () {
to = 5000
}, 5000)
f.mount('mnt')
setInterval(() => {
console.log(!!(data && buffers && ctx && on_op))
gc()
console.log(!!(f))
if (global.gc) gc()
}, 1000)
function on_op (buf) {
// foo = buf
console.log('on_op is called', buf)
// buffers.push(buf)
setTimeout(function () {
console.log('in timeout')
binding.fuse_native_signal(buf)
}, to)
}
// setTimeout(function () {
// foo = null
// console.log('now!')