How to use the ko/prefs.getLong function in ko

To help you get started, we’ve selected a few ko examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Komodo / KomodoEdit / src / modules / commando / content / sdk / commando.js View on Github external
if ( ! noDelay)
        {
            local.resultCache = local.resultCache.concat(results);
    
            if ( ! local.renderResultsTimer)
            {
                log.debug("Setting result timer");
                window.clearTimeout(local.renderResultsTimer);
                local.renderResultsTimer = window.setTimeout(function()
                {
                    log.debug("Triggering result timer");
                    this.renderResults(local.resultCache, searchUuid, true, true);
                    local.resultCache = [];
                    local.renderResultsTimer = false;
                }.bind(this), prefs.getLong("commando_result_render_delay"));
            }
            return;
        }

        log.debug(searchUuid + " - Rendering "+results.length+" Results");

        // Replace result elem with temporary cloned node so as not to paint the DOM repeatedly
        var resultElem = elem('results', true);
        
        // Delay height updates so it doesn't flicker too much while searching
        var height = resultElem.css("height");
        if ((height == "inherit" || ! height) && resultElem.element().boxObject.height > 150)
        {
            resultElem.css("height", resultElem.element().boxObject.height);
            clearTimeout(local.resultHeightTimer);
            local.resultHeightTimer = setTimeout(() =>
github Komodo / KomodoEdit / src / modules / commando / content / sdk / commando.js View on Github external
clearTimeout(local.resultHeightTimer);
            local.resultHeightTimer = setTimeout(() =>
            {
                elem('results', true).css("height", "inherit");
            }, prefs.getLong("commando_result_render_delay") + prefs.getLong("commando_search_delay") + 50);
        }
        
        var tmpResultElem = resultElem.element().cloneNode();
        resultElem.element().clearSelection();
        resultElem = $(resultElem.replaceWith(tmpResultElem));
        
        var isNew = local.resultsRendered === 0;
        if (isNew)
            this.empty(); // Force empty results
        
        var maxResults = prefs.getLong("commando_search_max_results", 50);
        maxResults -= local.resultsRendered;
        results = results.slice(0, maxResults);
        local.resultsRendered += results.length;

        if (local.resultsReceived == maxResults)
            log.debug("Reached max results");

        for (let result of results)
        {
            if (local.favourites.findString(result.id) != -1)
            {
                result.favourite = true;
            }
            
            if (result.icon && result.icon.substr(0,6) == 'koicon' &&
                               result.icon.substr(-3) == 'svg')
github Komodo / KomodoEdit / src / modules / commando / content / sdk / commando.js View on Github external
if (typeof subscopeId == "function")
                {
                    subscopeId(); // callback
                    return;
                }
                
                var subscope = resultElem.find(`richlistitem[result-id="${subscopeId}"]`);
                if (subscope.length)
                {
                    var data = subscope.element().resultData;
                    if ( ! data.isScope) return;
                    
                    c.setSubscope(data, true, selectSubscope);
                }
            }, prefs.getLong("commando_result_render_delay") + 10);
        }
github Komodo / KomodoEdit / src / chrome / komodo / content / startupWizard / startupWizard.js View on Github external
fields.wrapping.checked( !! prefs.getLong("editWrapType") );
        
        fields.autoDelimiters = require("ko/ui/checkbox").create("Wrap selection with typed delimiters (eg. quotes)");
        fields.autoDelimiters.checked( prefs.getBoolean("editSmartWrapSelection") );
        
        fields.autofill = require("ko/ui/checkbox").create("Automatically pick code completions using delimiters");
        fields.autofill.checked( prefs.getBoolean("codeintel_completion_auto_fillups_enabled") );
        
        fields.softchars = require("ko/ui/checkbox").create("Automatically insert ending delimiters and tags");
        fields.softchars.checked( prefs.getBoolean("codeintelAutoInsertEndTag") );
        
        fields.showLineNumbers = require("ko/ui/checkbox").create("Show line numbers in Editor");
        fields.showLineNumbers.checked( prefs.getBoolean("showLineNumbers") );
        
        fields.indentWidth = require("ko/ui/textbox").create({attributes: { type: "number", min: 1, max: 16, width: 60, maxlength: 2 }});
        fields.indentWidth.value( prefs.getLong("tabWidth") );
        
        fields.snippetBehavior = require("ko/ui/radiogroup").create(
            "Snippet Behavior: ",
        [
            { attributes: {
                label: "Trigger automatically while typing",
                value: "auto"
            }},
            { attributes: {
                label: "Insert using TAB key",
                value: "tab"
            }}
        ]);
        
        fields.snippetBehavior.value("auto"); // This is hard to detect given the way this is currently stored
github Komodo / KomodoEdit / src / modules / commando / content / sdk / commando.js View on Github external
this.search = function(value, callback, noDelay = false)
    {
        if (value)
        {
            elem('search').value(value);
        }

        if ( ! callback) // this is a manual search
            return onSearch();
        
        c.stop();

        elem("panel").addClass("loading");
        var searchDelay = prefs.getLong('commando_search_delay');
        
        log.debug("Event: onSearch");
        window.clearTimeout(local.searchTimer);
            
        var uuid = uuidGen.uuid();
        
        searchDelay = Math.max(0, searchDelay - (Date.now() - local.lastSearch));
        local.lastSearch = Date.now();
        local.searchTimer = window.setTimeout(function()
        {
            local.searchTimer = false;

            log.debug("Event: onSearch - Timer Triggered");
            
            var searchValue = elem('search').value();
github Komodo / KomodoEdit / src / modules / commando / content / sdk / commando.js View on Github external
log.debug(searchUuid + " - Rendering "+results.length+" Results");

        // Replace result elem with temporary cloned node so as not to paint the DOM repeatedly
        var resultElem = elem('results', true);
        
        // Delay height updates so it doesn't flicker too much while searching
        var height = resultElem.css("height");
        if ((height == "inherit" || ! height) && resultElem.element().boxObject.height > 150)
        {
            resultElem.css("height", resultElem.element().boxObject.height);
            clearTimeout(local.resultHeightTimer);
            local.resultHeightTimer = setTimeout(() =>
            {
                elem('results', true).css("height", "inherit");
            }, prefs.getLong("commando_result_render_delay") + prefs.getLong("commando_search_delay") + 50);
        }
        
        var tmpResultElem = resultElem.element().cloneNode();
        resultElem.element().clearSelection();
        resultElem = $(resultElem.replaceWith(tmpResultElem));
        
        var isNew = local.resultsRendered === 0;
        if (isNew)
            this.empty(); // Force empty results
        
        var maxResults = prefs.getLong("commando_search_max_results", 50);
        maxResults -= local.resultsRendered;
        results = results.slice(0, maxResults);
        local.resultsRendered += results.length;

        if (local.resultsReceived == maxResults)
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / simple-storage.js View on Github external
storages[name] = {};
        var storage = storages[name];
        
        // Set filename
        let storeFile = Cc["@mozilla.org/file/directory_service;1"].
                        getService(Ci.nsIProperties).
                        get("ProfD", Ci.nsIFile);
        storeFile.append("simple-storage");
        file.mkpath(storeFile.path);
        storeFile.append(name + ".json");
        storage.filename = storeFile.path;
        
        storage.jsonStore = new JsonStore({
            filename: storage.filename,
            writePeriod: prefs.getLong("simple-storage.write.period", 300000),
        });
        
        Object.defineProperties(storages[name], {
            storage: {
                enumerable: true,
                get: function() {
                    if (!storage.jsonStore.isRootInitialized)
                        storage.jsonStore.read();
                    return storage.jsonStore.root;
                },
                set: function(value) {
                    storage.jsonStore.root = value;
                }
            }
        });
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / profiler.js View on Github external
if (name == "" && ! enabled)
            return;

        if (name)
        {
            if (prefs.getString("profilerEnabledName", "") !== name)
                return;
        }

        this.stop(activeProfiler);
        activeProfiler = name;

        var features = prefs.getString("profilerFeatures", "stackwalk,js").split(",");
        profiler.StartProfiler(
            prefs.getLong("profilerMemory", 10000000),
            prefs.getLong("profilerSampleRate", 1),
            features,
            features.length
        );
    };
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / profiler.js View on Github external
{
        if (name == "" && ! enabled)
            return;

        if (name)
        {
            if (prefs.getString("profilerEnabledName", "") !== name)
                return;
        }

        this.stop(activeProfiler);
        activeProfiler = name;

        var features = prefs.getString("profilerFeatures", "stackwalk,js").split(",");
        profiler.StartProfiler(
            prefs.getLong("profilerMemory", 10000000),
            prefs.getLong("profilerSampleRate", 1),
            features,
            features.length
        );
    };
github Komodo / KomodoEdit / src / chrome / komodo / content / startupWizard / startupWizard.js View on Github external
fields.nativeBorders.checked(false);
                fields.colorScheme.enable();
            }
        });
        
        fields.nativeBorders = require("ko/ui/checkbox").create("Use native window borders");
        fields.nativeBorders.checked( ! prefs.getBoolean("ui.hide.chrome") );
        
        fields.minimap = require("ko/ui/checkbox").create("Use code minimap");
        fields.minimap.checked( prefs.getBoolean("editShowMinimap") );
        
        fields.taborspace = require("ko/ui/checkbox").create("Prefer tabs over spaces for indentation");
        fields.taborspace.checked( prefs.getBoolean("useTabs") );
        
        fields.wrapping = require("ko/ui/checkbox").create("Wrap long lines");
        fields.wrapping.checked( !! prefs.getLong("editWrapType") );
        
        fields.autoDelimiters = require("ko/ui/checkbox").create("Wrap selection with typed delimiters (eg. quotes)");
        fields.autoDelimiters.checked( prefs.getBoolean("editSmartWrapSelection") );
        
        fields.autofill = require("ko/ui/checkbox").create("Automatically pick code completions using delimiters");
        fields.autofill.checked( prefs.getBoolean("codeintel_completion_auto_fillups_enabled") );
        
        fields.softchars = require("ko/ui/checkbox").create("Automatically insert ending delimiters and tags");
        fields.softchars.checked( prefs.getBoolean("codeintelAutoInsertEndTag") );
        
        fields.showLineNumbers = require("ko/ui/checkbox").create("Show line numbers in Editor");
        fields.showLineNumbers.checked( prefs.getBoolean("showLineNumbers") );
        
        fields.indentWidth = require("ko/ui/textbox").create({attributes: { type: "number", min: 1, max: 16, width: 60, maxlength: 2 }});
        fields.indentWidth.value( prefs.getLong("tabWidth") );