Task

Access and print a URL's content (the located resource) to the console.

There is a separate task for HTTPS Requests.




property _netID
property _cbHandler
property _cbTarget
 
----------------------------------------
-- Simple HTTP GET request
-- @param {string} url
-- @param {symbol} cbHandler
-- @param {object} [cbTarget=_movie]
----------------------------------------
on new (me, url, cbHandler, cbTarget)
  if voidP(cbTarget) then cbTarget = _movie
  me._netID = getNetText(url)
  me._cbHandler = cbHandler
  me._cbTarget = cbTarget
  _movie.actorList.add(me)
  return me
end
 
----------------------------------------
-- @callback
----------------------------------------
on stepFrame (me)
  if netDone(me._netID) then
    res = netTextResult(me._netID)
    err = netError(me._netID)
    _movie.actorList.deleteOne(me)
    call(me._cbHandler, me._cbTarget, res, err)
  end if
end