<commit_before>/*
 * This file is part of the KUBEjs package
 *
 * (c) Red Scotch Software Inc <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
(function(KUBE) {
    "use strict";
    var uses = {
        "Color": '/Library/Drawing/Color',
        "DJ": '/Library/DOM/DomJack',
        "Convert": '/Library/Tools/Convert',
        "XObject": '/Library/Extend/Object'
    }

    KUBE.LoadFactory('/Library/Drawing/Spinner', Spinner, uses);

    Spinner.prototype.toString = function () {
        return '[object ' + this.constructor.name + ']'
    };
    function Spinner(options) {
        var $K = KUBE.Class(uses),
            spinJack,
            rawSpin,
            rawCtx,
            playTimer,
            lastFrameTime,
            framePos = -1,
            playState = false,
            DJ = $K.DJ;
        
        //DEFAULT SPINNER SETTINGS
        var options = {
            "radius": 25,
            "height": 25,
            "width": 10,
            "dashes": 10,
            "opacity": 1,
            "padding": 2,
            "rotation": 700,
            "color": "#000"
        };

        var $spinAPI = {
            "Get": Get,
            "Play": Play,
            "Pause": Pause,
            "Radius": SetRadius,
            "Height": SetHeight,
            "Width": SetWidth,
            "Dashes": SetDashes,
            "Opacity": SetOpacity,
            "Padding": SetPadding,
            "Rotation": SetRotation,
            "Color": SetColor
        }

        return $spinAPI;

        //THIS IS HOW YOU GET YOUR SPINNER DOMJACK!

        function Get(){
            if(!spinJack){
               initSpinJack();
            }
            return spinJack;
        }

        //STATE CONTROL 
        //TODO: ADD EVENTS TO CONTROL STATE AS WELL

        function Play(){
            if(spinJack && !spinJack.IsDetached()){
                if(playState){
                    return; //I'm already playing!
                }
                playState = true;
                _nextFrame();
            }
            else{
                throw new Error('Cannot play spinner until it is attached to the DOM');
            }
        }

        function Pause(){
            if(!playState){
                return; //I'm already paused;
            }
            lastFrameTime = 0;
            playState = false;
        }

        //SETTERS FOR OPTIONS
        //TODO: A SETTER THAT TAKES IN AN OBJECT AND CALLS ALL OF THEM, OR AS PART OF INITIAL CALL

        function SetRadius(_radius){
            if(KUBE.Is(_radius) === "number"){
                options.radius = _radius;
            }
            return $spinAPI;
        }
        
        function SetHeight(_height){
            if(KUBE.Is(_height) === "number"){
                options.height = _height;
            }
            return $spinAPI;
        }
        
        function SetWidth(_width){
            if(KUBE.Is(_width) === "number"){
                options.width = _width;
            }<commit_msg>Unfixed some of spinner because I broke it?<commit_after>/*
 * This file is part of the KUBEjs package
 *
 * (c) Red Scotch Software Inc <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
(function(KUBE) {
    "use strict";
    var uses = {
        "Color": '/Library/Drawing/Color',
        "DJ": '/Library/DOM/DomJack',
        "Convert": '/Library/Tools/Convert',
        "XObject": '/Library/Extend/Object'
    }

    KUBE.LoadFactory('/Library/Drawing/Spinner', Spinner, uses);

    Spinner.prototype.toString = function () {
        return '[object ' + this.constructor.name + ']'
    };
    function Spinner(options) {
        var $K = KUBE.Class(uses),
            spinJack,
            rawSpin,
            rawCtx,
            playTimer,
            lastFrameTime,
            framePos = -1,
            playState = false,
            DJ = $K.DJ;
        
        //DEFAULT SPINNER SETTINGS
        var options = {
            "radius": 25,
            "height": 25,
            "width": 10,
            "dashes": 10,
            "opacity": 1,
            "padding": 2,
            "rotation": 700,
            "color": "#000"
        };

        var $spinAPI = {
            "Get": Get,
            "Play": Play,
            "Pause": Pause,
            "Radius": SetRadius,
            "Height": SetHeight,
            "Width": SetWidth,
            "Dashes": SetDashes,
            "Opacity": SetOpacity,
            "Padding": SetPadding,
            "Rotation": SetRotation,
            "Color": SetColor
        }

        return $spinAPI;

        //THIS IS HOW YOU GET YOUR SPINNER DOMJACK!

        function Get(){
            if(!spinJack){
               initSpinJack();
            }
            return spinJack;
        }

        //STATE CONTROL 
        //TODO: ADD EVENTS TO CONTROL STATE AS WELL

        function Play(){
            if(playState){
                return; //I'm already playing!
            }
            playState = true;
            _nextFrame();
        }

        function Pause(){
            if(!playState){
                return; //I'm already paused;
            }
            lastFrameTime = 0;
            playState = false;
        }

        //SETTERS FOR OPTIONS
        //TODO: A SETTER THAT TAKES IN AN OBJECT AND CALLS ALL OF THEM, OR AS PART OF INITIAL CALL

        function SetRadius(_radius){
            if(KUBE.Is(_radius) === "number"){
                options.radius = _radius;
            }
            return $spinAPI;
        }
        
        function SetHeight(_height){
            if(KUBE.Is(_height) === "number"){
                options.height = _height;
            }
            return $spinAPI;
        }
        
        function SetWidth(_width){
            if(KUBE.Is(_width) === "number"){
                options.width = _width;
            }
{'fraction_non_alphanumeric': 0.11262458471760797, 'fraction_numerical': 0.005980066445182724, 'mean_word_length': 1.3077807589114603, 'pattern_counts': {'":': 46, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4914351', 'n_tokens_mistral': 1722, 'n_tokens_neox': 1613, 'n_words': 436}