import { makeLog } from "../utils/devOnly";





/**
 * this basic plugin is for demonstration only
 */

const name = 'aamir'; // plugin name, *must* be unique
const log = makeLog(name)

const basicPlugin = {
    name,
    // setup is called when the plugin is loaded and before initing the player
    setup: (config) => {
        log(`${name} setup`, config);
    },

    // onload is called when the player is ready but sources are not loaded yet
    onload: (player) => {
        log("the inner player", player.activePlayer);
    },


    // this gets called when the player is mannuall destroyed
    // e.g by calling player.destroy()
    destroy: (player) => {
        log(`destroing ${name}`, player);
    },


    // if the name of the function is the same as the plugin name
    // it will be added to the player and can be accessed via player.aamir
    // if you pass the function as arrow function it will not get player binding
    // and if you want to access the player pass the function as `function` and the function will gets boud to the player
    [name]: function aamir(now) {
        log(`calling ${name} plugin ${+now}`, this);
        return this;
    }
}


export default basicPlugin;