Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there dojo.hitch equivalent in node.js

Tags:

node.js

dojo

I am looking for a function that kind bind the 'this' of a function. Although it is easy to write one, I want to be sure that it is not part of any popular module in node.js environment before I write or use the one from dojo.

like image 467
Ramki Avatar asked Aug 21 '11 14:08

Ramki


People also ask

What is Lang hitch in dojo?

dojo/_base/lang — The Dojo Toolkit - Reference Guide. hitch() returns a function that will execute a given function in a given context. This function allows you to control how a function executes, particularly in asynchronous operations.

Can I use JavaScript in node JS?

Node.js allows you to run JavaScript on the server.


1 Answers

(function() {
  alert(this.toString());
}).bind(new String("Man ES5 is awesome.")).call();

Function.prototype.bind[docs]

Node.js runs on V8. V8 is fully ES5 compliant.

like image 192
Raynos Avatar answered Sep 28 '22 07:09

Raynos