Updated pass-to-controller method

While for the sake of just a cool implementation I liked using
setInterval, it ultimately isn’t necessary at this point as we’re
waiting on just one promise event that is already being handled
asynchronously and is capable of triggering the view controller all on
its own.

The issue was, I still didn’t want to include a direct call to
“outputData” in the omdbSearch object’s searchAPI method since to me,
that violates MVC ideas by placing responsibility for view output on
the model.

However, by adding a single argument to the method searchAPI() so it is
now searchAPI(callBack), the method remains abstract and flexible—I can
dictate which view controller is called when the XML request is
complete without having to modify the object code for different
implementations. For now, I think it’s a decent way to go.

TODO:
Implement a global run loop of sorts (similar to NSRunLoop in Obj-C)
that would begin execution upon page load. I’d feed it a object and a
state (in this case MovieSearcher.bSearchComplete == true), and when
that state is achieved, tell it to call a specific function or object
method to begin display of the data. Ultimately, that’s the abstraction
I want here, just don’t have the time (or perhaps the need) to
implement right now.
RunLoop Experiment + SearchVC Stub

Woke up with a thought about my Run Loop. Decided to test.

I’m now using setInterval (in a global context, executed on page load)
to create my own Run Loop. Implemented a very simple version of it here
just so I could see how it affected responsiveness in the browser. So
far, I’ve tested intervals down to 100ms without any noticeable
degradation (at least no noticeable degradation in this very simple web
app). All this Run Loop does (for the moment) is continually check on
the state of MovieSearcher.bSearchComplete and send a message to the
console indicating it has achieved its goal. Since this does what its
intended to do so far, I’m going to see if I can ultimately use it to
avoid having to send a specific callback function to the
omdbSearch.searchAPI() method as this would allow for a near complete
distinction between the model and view controller. The Run Loop listens
for a designated state change, and when it happens, the execution flow
continues.

TODO:
1. Remove callBack from searchAPI method and update code to call view
controller using this event listener instead.

2. Abstract this idea into a class that is essentially a private
(non-DOM) event listener. Need to be able to register events to listen
for in an organized way and then take specific actions.

——

Also added a stub for a SearchViewController that I’ll implement at
some point.