Finsemble: Using Mind Control

Using Mind Control

Mind Control is the ability to inject custom scripts into Finsemble components built using third-party websites. This tutorial will walk you through the basics of using Mind Control using the Google Drive website as a component.

Using The CLI

You can use the finsemble-cli to create a Mind Control component:

finsemble-cli add component --component-type=mc --url=https://drive.google.com/ googleDrive

This will create a Google Drive Mind Control component with a single JavaScript file—googleDrive.js. It will also create the proper entries so that the file is built by Webpack. This file will injected into your component. Since the file is built by Webpack, you can use require to include other files and libraries.

Manually Adding MindControl to a Component

To add Mind Control to a component manually, you need to add the inject property to the component config:

"My Component": {
    "window": {
        "url": "https://someurl.com/foo/bar/",
        ...
    },
    "component": {
        "inject": "myfancyscript.js"
    },
    ...
}

If you don't specify a path for the file it looks for the file in 'baseURL' + /components/mindcontrol/ folder. Make sure your build process puts the file in that folder. You can also specify a full path if your component lives elsewhere. You can also specify a list of files to be included:

"My Component": {
    "window": {
        "url": "https://someurl.com/foo/bar/",
        ...
    },
    "component": {
        "inject": ["https://myurl.com/myfancyscript.js", "myuberfancyscript.js"]
    },
    ...
}