dcefram / xjs

Originally a fork of xjsframework/xjs, but re-written from the ground up
1 stars 0 forks source link

Create helper function to stub XSplit-only external functions #27

Open dcefram opened 4 years ago

dcefram commented 4 years ago

Background

While developing plugins on non-Windows environment, XJS would always throw an error. The workaround is to stub the external methods so that the plugin could run in the browser.

This is useful when developing the UI of the plugin, wherein the developer tools/extensions in your favorite browser might not work properly in the remote debugger. (ex: React developer tools).

Suggestion

Create a helper module that would contain methods to stub the XSplit-specific functions. The basic functionality could be as simple as just preventing JS from throwing errors when we try accessing XSplit-specific functions.

A huge plus would be if it is possible to define a way to properly mock the XSplit-specific functions such that it could be used to mock the responses when the plugin developer opts to take advantage of some sort of CI for their development workflow.

dcefram commented 4 years ago

Turns out that it should be as easy as modifying the internal.ts file, and just prevent throwing an error if external xsplit methods do not exist.

I created an IXSplitExternal interface that should list all the XSplit external functions. We'll have to complete that interface sometime in the future. Will leave this issue open until we're done with that.