Im getting an Uncaught TypeError: Cannot read property 'target' of undefined when calling widget.Test() in the beforeAppear.
define(
          //-------------------------------------------------------------------
          // DEPENDENCIES
          //-------------------------------------------------------------------
        ['knockout'],
        // -------------------------------------------------------------------
        // MODULE DEFINITION
        // -------------------------------------------------------------------
        function (ko) {
        "use strict";
        return {
            First_Arr: ko.observableArray(['arrayItem0', 'arrayItem1', 'arrayItem2', 'arrayItem3']),
            Second_Arr: ko.observableArray(['arrayItem0', 'arrayItem1', 'arrayItem2']),
            Test: function(widget, event) {            
                var element = event.target;          
                var pathname = location.pathname;
                var anotherArray = [
                    ["/some-url-path", widget.First_Arr()],
                    ["/some-other-url-path", widget.Second_Arr()]
                ];
                for (var i = 0; i < anotherArray.length; i++) {
                    // Do some stuff and console.log the array items                        
                }
            },
            beforeAppear: function(page) {
                var widget = this;
                widget.Test();
            }
        }
    }
);
The strange thing is, if I create a button in my view for example:
<button id="btn-click" data-bind="click: Test">test</button>
And click it, then I get the desired results of printing out the contents of my array to the console as expected.
PS. I tried commenting out the var element = event.target; line since I figured this was the source of the problem however this just produced the following: Uncaught TypeError: Cannot read property 'First_Arr()' of undefined.
A bit at a loss with this one. Any assistance would be helpful.
 
     
    