stage

<script src="./point_src/stage"></script>

A Stage acts as a convenience tool to hoist a canvas and begin drawing however it's not fundamental.

The Stage helps manage loading and looping of draw functions Extend with your own custom functionality and run the go() method:

class MainStage extends Stage {
    // canvas = document.getElementById('playspace');
    canvas = 'playspace'
}

stage = MainStage.go({
    loop: true
})

This will execute the canvas name. It provides some free tools:

  1. mount() and draw(ctx) functions
  2. load capture events
  3. size locking and auto resizing
  4. optional request frame loop
  5. builtin measurement tools; center and dimensions
Meta Data
dependencies ()
unused_keys ('title',)
unknown_keys ('files',)
files ['', 'stage-hooks.js', 'functions/resolve.js']
filepath_exists True
path stage
filepath stage.js
clean_files ('stage-hooks.js', 'functions/resolve.js')

  • ClassDeclaration
    class comments:

    an addon instance has anounced itself. Perform the addComponent

    • method

      addonAnnounceHandler

      (
      ev
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      an addon instance has anounced itself. Perform the addComponent

      this.dispatch('stage:prepare', {target, id, canvas })

    • method

      dispatch

      (
      name , data
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      this.dispatch('prepare', { target, id, stage: this, canvas })

    • method

      _dispatchPrepare

      (
      data
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Given a dictionary, return a finished dictionary, ready for event dispatch

    • method

      addComponent

      (
      name , instance
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      a given object is mounted on this - such as the mouse. This may be called in response to a 'stage:prepare' event.

    • method

      log

      (
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      console.log.apply(console, Array.from(arguments))

    dict_keys(['kind', 'word', 'parentName', 'type', 'body', 'comments', 'pos'])
  • ClassDeclaration
    class comments:

    Stage Lifecycle

    constructor prepare stickCanvasSize mounted ?load

    go cleanGoConfig ?prepare update stageStartDraw firstDraw update update draw unfreeze loopDraw update draw loopDraw

    • property

      $drawFunc

      from StageRender
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      _loopDraw

      = true
      from StageRender
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      initData

      from StageRender
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • constructor

      constructor

      (
      canvas , drawFunc
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Accept a canvas node and an optional draw function, prepare the stage draw routine. If the canvas is given, immediately call this.prepare(canvas) to initiate the layer.

      new StageRender(canvas, ()=>{})
      

      Any given drawFunc overrides the existing this.stageStartDraw method and expects the next method to call once complete:

      The default this.draw(ctx) method is given`

      this.stageStartDraw(this.draw)
      
    • method

      stickCanvasSize

      (
      canvas , size
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Return the result of the bounding box function, else resort to the object w/h

    • get

      center

      (
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      prepare

      (
      target
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Perform any preparations for this stage instance to run the canvas tools. This includes resolving and measuring the canvas.

      class MainStage extends Stage {
          canvas = playspace
          prepare(target){
              super.prepare(target)
              // ...
          }
      }
      

      This will run automatically if the canvas is given in the constructor

      new MainStage(canvas)
      // _prepared == true
      

      Once prepared the stage is essentially ready-to-go.

      stage = new MainStage()
      stage.prepare(canvas)
      stage.update()
      
    • method

      mounted

      (
      canvas
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Empty API Method

      A Convenient place to perform initial work.

    • method

      stop

      (
      freeze = True
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      go

      (
      additionalData = {}
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Make a copy of a new Stage. Call prepare() if required. If additionalData.loop is true (default) start the update loopDraw

    • method

      freeze

      (
      freeze = True
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      unfreeze

      (
      timeout , force
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      1ms delay for a next tick.

    • method

      go

      (
      additionalData = {}
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Make a copy of a new Stage. Call prepare() if required. If additionalData.loop is true (default) start the update loopDraw

    • method

      announce

      (
      additionalData
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      stageStartDraw

      (
      drawFunc
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      When using the internal loop drawing the first draw call occurs through this method, calling firstDraw once, then changing the internal draw function to the typical this.draw

      If this.draw is not a method, this.update() is not called and the stopDraw method is called.

    • method

      loopDraw

      (
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      A helper function to apply this stage to the animation frame, calling update() for every frame.

      Call once to start the loop.

          stage = new MainStage()
          stage.prepare(canvas)
          stage.loopDraw()
      
    • get

      ctx

      (
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Return the cached context object of the current canvas.

    • method

      getContext

      (
      canvas , type = 2d
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
      • alpha: A boolean value that indicates if the canvas contains an alpha channel. If set to false, the browser now knows that the backdrop is always opaque, which can speed up drawing of transparent content and images.

      • colorSpace Optional: Specifies the color space of the rendering context. Possible values are:

            "srgb" selects the sRGB color space. (default value)
            "display-p3" selects the display-p3 color space.
        
      • desynchronized: A boolean value that hints the user agent to reduce the latency by desynchronizing the canvas paint cycle from the event loop.

      • willReadFrequently: A boolean value that indicates whether or not a lot of read-back operations are planned. This will force the use of a software (instead of hardware accelerated) 2D canvas and can save memory when calling getImageData() frequently.

    • method

      update

      (
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      inline update per draw. For each call:

      • all drawBefore methods
      • all nextTick methods
      • the draw method (mapped through this.$drawFunc)
      • all drawAfter methods
    • method

      nextTick

      (
      func
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Run the given function (with context) on the next draw call. This function is very similar to onDrawBefore, but only runs once.

      stage.nextTick(function(ctx){
          // run next time.
          stage.runCustomRender(ctx)
      })
      

      This is useful for performing clearups, or running routines on single action:

      let v = this.v = new Value(this.p.radius, width, easing)
      v.doneHandler = ()=>{
          // st.switchOut()
          this.nextTick(this.switchOut.bind(this))
      }
      
      switchOut() {
          this.log('doneHandler')
          this.v = undefined;
      }
      
    • method

      onTick

      (
      tick , func
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      call the function after a number of ticks has succeded, cycled.

      This apply a new method to the onDrawBefore stack, executing the function every modulu 0.

    • method

      onDrawBefore

      (
      func
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      this._drawBefore.push(func)

    • method

      onDrawAfter

      (
      func
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      this._drawAfter.push(func)

    • method

      offDrawAfter

      (
      func
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      let i = this._drawAfter.indexOf(func)

    • method

      offDrawBefore

      (
      func
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      let i = this._drawBefore.indexOf(func)

    • method

      firstDraw

      (
      ctx
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Empty API Method

      Gym Bag.

      The firstDraw(ctx) method us used once when drawing starts. This occurs before the first update() call is performed.

      This is useful if you're setting context arguments - but only need to set them once.

      class Main extends Stage {
          firstDraw(ctx) {
              ctx.fillStyle = '#ccc'
              ctx.font = 'normal 1em arial'
          }
      }
      
    • method

      draw

      (
      ctx
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Empty API Method

      The primary rendering function to override. Called by the update() method, given the context ctx of the target canvas.

      This is essentially the same as running the update function manually:

      const ctx = canvas.getContext('2d');
      const stage = new MainStage()
      
      stage.prepare(canvas)
      
      function draw() {
      
          // or: stage.clear(ctx)
          ctx.clearRect(0, 0, canvas.width, canvas.height);
      
          // Run the draw routines
          stage.draw(ctx)
      
          // And rinse repeat.
          requestAnimationFrame(draw);
      
      }
      
      draw()
      
    • method

      clear

      (
      ctx , fillStyle
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Perform a standard 'clearRect' using the cached dimensions of the canvas.

      stage.clear(ctx)
      

      Synonymous to:

      const ctx = canvas.getContext('2d');
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      

      Apply an optional flood fillStyle:

      stage.clear(ctx, '#000')
      
    • method

      addonAnnounceHandler

      (
      ev
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      an addon instance has anounced itself. Perform the addComponent

      this.dispatch('stage:prepare', {target, id, canvas })

    • method

      dispatch

      (
      name , data
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      this.dispatch('prepare', { target, id, stage: this, canvas })

    • method

      _dispatchPrepare

      (
      data
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Given a dictionary, return a finished dictionary, ready for event dispatch

    • method

      addComponent

      (
      name , instance
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      a given object is mounted on this - such as the mouse. This may be called in response to a 'stage:prepare' event.

    • method

      log

      (
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      console.log.apply(console, Array.from(arguments))

    dict_keys(['kind', 'word', 'parentName', 'type', 'body', 'comments', 'pos'])
  • ClassDeclaration
    class comments:

    Called once by the prepare() method, to act as a first-time loader for the stage.

    Apply global hooks here.

    • property

      loaded

      = false
      from Stage
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • method

      prepare

      (
      target
      )
      from Stage
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      load

      (
      )
      from Stage
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Called once by the prepare() method, to act as a first-time loader for the stage.

      Apply global hooks here.

    • property

      $drawFunc

      from StageRender
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      _loopDraw

      = true
      from StageRender
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      initData

      from StageRender
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • constructor

      constructor

      (
      canvas , drawFunc
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Accept a canvas node and an optional draw function, prepare the stage draw routine. If the canvas is given, immediately call this.prepare(canvas) to initiate the layer.

      new StageRender(canvas, ()=>{})
      

      Any given drawFunc overrides the existing this.stageStartDraw method and expects the next method to call once complete:

      The default this.draw(ctx) method is given`

      this.stageStartDraw(this.draw)
      
    • method

      stickCanvasSize

      (
      canvas , size
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Return the result of the bounding box function, else resort to the object w/h

    • get

      center

      (
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      prepare

      (
      target
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Perform any preparations for this stage instance to run the canvas tools. This includes resolving and measuring the canvas.

      class MainStage extends Stage {
          canvas = playspace
          prepare(target){
              super.prepare(target)
              // ...
          }
      }
      

      This will run automatically if the canvas is given in the constructor

      new MainStage(canvas)
      // _prepared == true
      

      Once prepared the stage is essentially ready-to-go.

      stage = new MainStage()
      stage.prepare(canvas)
      stage.update()
      
    • method

      mounted

      (
      canvas
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Empty API Method

      A Convenient place to perform initial work.

    • method

      stop

      (
      freeze = True
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      go

      (
      additionalData = {}
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Make a copy of a new Stage. Call prepare() if required. If additionalData.loop is true (default) start the update loopDraw

    • method

      freeze

      (
      freeze = True
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      unfreeze

      (
      timeout , force
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      1ms delay for a next tick.

    • method

      go

      (
      additionalData = {}
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Make a copy of a new Stage. Call prepare() if required. If additionalData.loop is true (default) start the update loopDraw

    • method

      announce

      (
      additionalData
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      stageStartDraw

      (
      drawFunc
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      When using the internal loop drawing the first draw call occurs through this method, calling firstDraw once, then changing the internal draw function to the typical this.draw

      If this.draw is not a method, this.update() is not called and the stopDraw method is called.

    • method

      loopDraw

      (
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      A helper function to apply this stage to the animation frame, calling update() for every frame.

      Call once to start the loop.

          stage = new MainStage()
          stage.prepare(canvas)
          stage.loopDraw()
      
    • get

      ctx

      (
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Return the cached context object of the current canvas.

    • method

      getContext

      (
      canvas , type = 2d
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
      • alpha: A boolean value that indicates if the canvas contains an alpha channel. If set to false, the browser now knows that the backdrop is always opaque, which can speed up drawing of transparent content and images.

      • colorSpace Optional: Specifies the color space of the rendering context. Possible values are:

            "srgb" selects the sRGB color space. (default value)
            "display-p3" selects the display-p3 color space.
        
      • desynchronized: A boolean value that hints the user agent to reduce the latency by desynchronizing the canvas paint cycle from the event loop.

      • willReadFrequently: A boolean value that indicates whether or not a lot of read-back operations are planned. This will force the use of a software (instead of hardware accelerated) 2D canvas and can save memory when calling getImageData() frequently.

    • method

      update

      (
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      inline update per draw. For each call:

      • all drawBefore methods
      • all nextTick methods
      • the draw method (mapped through this.$drawFunc)
      • all drawAfter methods
    • method

      nextTick

      (
      func
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Run the given function (with context) on the next draw call. This function is very similar to onDrawBefore, but only runs once.

      stage.nextTick(function(ctx){
          // run next time.
          stage.runCustomRender(ctx)
      })
      

      This is useful for performing clearups, or running routines on single action:

      let v = this.v = new Value(this.p.radius, width, easing)
      v.doneHandler = ()=>{
          // st.switchOut()
          this.nextTick(this.switchOut.bind(this))
      }
      
      switchOut() {
          this.log('doneHandler')
          this.v = undefined;
      }
      
    • method

      onTick

      (
      tick , func
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      call the function after a number of ticks has succeded, cycled.

      This apply a new method to the onDrawBefore stack, executing the function every modulu 0.

    • method

      onDrawBefore

      (
      func
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      this._drawBefore.push(func)

    • method

      onDrawAfter

      (
      func
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      this._drawAfter.push(func)

    • method

      offDrawAfter

      (
      func
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      let i = this._drawAfter.indexOf(func)

    • method

      offDrawBefore

      (
      func
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      let i = this._drawBefore.indexOf(func)

    • method

      firstDraw

      (
      ctx
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Empty API Method

      Gym Bag.

      The firstDraw(ctx) method us used once when drawing starts. This occurs before the first update() call is performed.

      This is useful if you're setting context arguments - but only need to set them once.

      class Main extends Stage {
          firstDraw(ctx) {
              ctx.fillStyle = '#ccc'
              ctx.font = 'normal 1em arial'
          }
      }
      
    • method

      draw

      (
      ctx
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Empty API Method

      The primary rendering function to override. Called by the update() method, given the context ctx of the target canvas.

      This is essentially the same as running the update function manually:

      const ctx = canvas.getContext('2d');
      const stage = new MainStage()
      
      stage.prepare(canvas)
      
      function draw() {
      
          // or: stage.clear(ctx)
          ctx.clearRect(0, 0, canvas.width, canvas.height);
      
          // Run the draw routines
          stage.draw(ctx)
      
          // And rinse repeat.
          requestAnimationFrame(draw);
      
      }
      
      draw()
      
    • method

      clear

      (
      ctx , fillStyle
      )
      from StageRender
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Perform a standard 'clearRect' using the cached dimensions of the canvas.

      stage.clear(ctx)
      

      Synonymous to:

      const ctx = canvas.getContext('2d');
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      

      Apply an optional flood fillStyle:

      stage.clear(ctx, '#000')
      
    • method

      addonAnnounceHandler

      (
      ev
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      an addon instance has anounced itself. Perform the addComponent

      this.dispatch('stage:prepare', {target, id, canvas })

    • method

      dispatch

      (
      name , data
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      this.dispatch('prepare', { target, id, stage: this, canvas })

    • method

      _dispatchPrepare

      (
      data
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Given a dictionary, return a finished dictionary, ready for event dispatch

    • method

      addComponent

      (
      name , instance
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      a given object is mounted on this - such as the mouse. This may be called in response to a 'stage:prepare' event.

    • method

      log

      (
      )
      from StageBase
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      console.log.apply(console, Array.from(arguments))

    dict_keys(['kind', 'word', 'parentName', 'type', 'body', 'comments', 'pos'])
  • ExpressionStatement

    :

    dict_keys(['type', 'expression', 'pos'])