| Server IP : 203.96.225.131 / Your IP : 216.73.216.19 Web Server : nginx/1.24.0 System : Linux iot1 6.8.0-151-generic #151-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 11 01:28:36 UTC 2026 x86_64 User : papel ( 1002) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /dma/project-211/project/mapbd/node_modules/require/node_modules/std/ |
Upload File : |
/*
Example usage:
function Client() {
this._socket = new Connection()
this._socket.open()
this._socket.on('connected', bind(this, '_log', 'connected!'))
this._socket.on('connected', bind(this, 'disconnect'))
}
Client.prototype._log = function(message) {
console.log('client says:', message)
}
Client.prototype.disconnect = function() {
this._socket.disconnect()
}
Example usage:
var Toolbar = Class(function() {
this._init = function() {
this._buttonWasClicked = false
}
this.addButton = function(clickHandler) {
this._button = new Button()
this._button.on('Click', bind(this, '_onButtonClick', clickHandler))
}
this._onButtonClick = function(clickHandler) {
this._buttonWasClicked = true
clickHandler()
}
})
*/
var slice = require('./slice')
module.exports = function bind(context, method /* curry1, curry2, ... curryN */) {
if (typeof method == 'string') { method = context[method] }
var curryArgs = slice(arguments, 2)
return function bound() {
var invocationArgs = slice(arguments)
return method.apply(context, curryArgs.concat(invocationArgs))
}
}