You all know we can see a function’s implementation with Web Inspector:
The inspector says what is the implementation:
I realised that if I bind
STCustom function anything else, the implementation will not be visible.
Let’s wrap it and bind to undefined.
Now, let’s see it’s implementation:
It’s not visible. But it’s not useful for now. Let’s abuse it more. :)
OK, It’s still visible. Let’s
.bind it to nothing again:
Now, it’s hidden again. What about the methods?
These are visible. So we should hide them too, abusing “bind”:
We bound all the methods to the object itself. So it couldn’t be inspected.
We also freezed that class, you cannot extend it anymore:
As you see, we are not able to access
prototype of the class.
Why is that?
.bind method’s implementation. It returns a bounded native function, so you see the native one all the time, not your implementation. It’s like proxying the function over browser.
It’s not for production use, just a small trick that I realised.
Sorry for my English mistakes.