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:
parent
cf9234e856
commit
48d991ac79
39
index.js
39
index.js
@ -4,43 +4,30 @@ console.log(binding)
|
|||||||
|
|
||||||
class Fuse {
|
class Fuse {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.fuseThread = Buffer.alloc(binding.sizeof_fuse_thread_t)
|
this._thread = Buffer.alloc(binding.sizeof_fuse_thread_t)
|
||||||
}
|
}
|
||||||
|
|
||||||
mount (mnt) {
|
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 f = new Fuse()
|
||||||
const data = Buffer.alloc(binding.sizeof_fuse_thread_t)
|
|
||||||
let buffers = []
|
|
||||||
let foo
|
|
||||||
|
|
||||||
binding.fuse_native_mount('mnt', '-odebug', data, ctx, on_op)
|
f.mount('mnt')
|
||||||
|
|
||||||
let to = 1
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
to = 5000
|
|
||||||
}, 5000)
|
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
console.log(!!(data && buffers && ctx && on_op))
|
console.log(!!(f))
|
||||||
gc()
|
if (global.gc) gc()
|
||||||
}, 1000)
|
}, 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 () {
|
// setTimeout(function () {
|
||||||
// foo = null
|
// foo = null
|
||||||
// console.log('now!')
|
// console.log('now!')
|
||||||
|
Loading…
Reference in New Issue
Block a user