Flake User Object (FUO) & Flake System Objects (FSO)

The Flake User Object code is written by the flake developer and contains most of the flake functionality.

If a flake appears only once in a user’s page set, this code is called once to instantiate the flake. If the flake appears more than once, the code is called multiple times – once for every flake instance.

Here is the Flake User Object code for the example flake:

<script id='com.approver.hello' type='text/javascript'>

        function com_pageflakes_hello(id)
        {
            this.id = id;
            this.fso = null;

            this.load = function()
            {
                // Need to do this in "onload" to ensure the framework
                // has loaded the HTML portion of the flake
                var div = $(id + "content");
                div.innerHTML = "Hello world!";
            };
        }

</script>

The class containing the code is called com_pageflakes_hello. It takes a single parameter, id, which contains a unique identifier for the flake being created. This id is what the framework uses when it replaces the _PAGEFLAKES_ string.