Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / phantomjs / lib / phantom / examples / sleepsort.coffee
1 ###
2 Sort integers from the command line in a very ridiculous way: leveraging timeouts :P
3 ###
4
5 system = require 'system'
6
7 if system.args.length < 2
8   console.log "Usage: phantomjs sleepsort.coffee PUT YOUR INTEGERS HERE SEPARATED BY SPACES"
9   phantom.exit 1
10 else
11   sortedCount = 0
12   args = Array.prototype.slice.call(system.args, 1)
13   for int in args
14     setTimeout (do (int) ->
15       ->
16         console.log int
17         ++sortedCount
18         phantom.exit() if sortedCount is args.length),
19       int
20