Verified Commit 13f1e50d authored by Aral Balkan's avatar Aral Balkan
Browse files

Instrument reads

parent eb8e333b
const isProxy = require('util').types.isProxy
const Time = require('./Time')
class DataProxy {
......@@ -19,11 +20,17 @@ class DataProxy {
getHandler (target, property, receiver) {
// console.log('get', target, property, receiver)
console.log(` 💾 ❨WhatDB?❩ Getting ${property} on ${this.table.tableName}`)
const requestedObject = Reflect.get(, property, receiver)
console.log(` 💾 ❨WhatDB?❩ ╰─ Reflection took ${Time.elapsed()} ms.`)
// If this is an object and not already a proxy, ensure that it is lazily proxified.
if (requestedObject !== null && !isProxy(requestedObject) && typeof requestedObject === 'object') {
console.log('============== NEW DATA PROXY =================', property)
return new DataProxy(this.table, requestedObject)
const dataProxy = new DataProxy(this.table, requestedObject)
console.log(` 💾 ❨WhatDB?❩ ╰─ Proxification took ${Time.elapsed()} ms.`)
return dataProxy
} else {
return requestedObject
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment