Node tasks

NodeTasks allow you to write a task by simply creating a class, and implementing an execute function. This saves developers having to worry about roku node implementation details.

Implementation

Example

import "pkg:/source/core/Request.bs"
import "pkg:/source/roku_modules/log/LogMixin.brs"
import "pkg:/source/core/Utils.bs"
import "pkg:/source/core/Registry.bs"
import "pkg:/source/core/AssetBundle.bs"

namespace mc
  @strict
  @task("mc_AssetBundleTask", "Task")
  class AssetBundleTask
    private log
    private baseBundleUrl
    private bundleId
    private registry
    private request

    private url = ""

    function new()
      m.log = new log.Logger("ImageRequestTask")
    end function

    private function execute(args)
      m.bundleId = args.bundleId
      m.baseBundleUrl = args.baseBundleUrl

      m.registry = new mc.Registry()
      m.request = m.makeRequest()
      ...
      return {
        isOK: true
        data: data
      }