-
-
Save briancavalier/d43f358f4dd078a3e017 to your computer and use it in GitHub Desktop.
PhantomJS test of using cujoJS/poly for Function.prototype.bind
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(), | |
system = require('system'), | |
address; | |
if (system.args.length === 1) { | |
console.log('Please specify a url'); | |
phantom.exit(); | |
} | |
page.onConsoleMessage = function (msg) { | |
console.log('BROWSER', msg); | |
}; | |
address = system.args[1]; | |
page.open(address, function (status) { | |
if (status !== 'success') { | |
console.log('FAIL to load the address'); | |
phantom.exit(); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<title>test</title> | |
<script> | |
curl = { | |
baseUrl: '../', | |
paths: { | |
curl: 'test/curl' | |
}, | |
packages: [ | |
{ name: 'poly', location: '.', main: 'poly' } | |
] | |
}; | |
</script> | |
<script src="curl.js"></script> | |
<script> | |
curl(['poly/function'], function() { | |
try { | |
// var x = Function.prototype.call.bind; | |
var slice = Function.prototype.call.bind(Array.prototype.slice); | |
console.log(slice, slice([1,2,3], 1)); | |
} catch(e) { | |
console.log(e); | |
} | |
}); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment