Sha256: 7059a2678307fc6f7b9170416e1eed76dcb808499be0a34275e416f6de70769d

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

include('uki.js');

/**
 * @namespace
 */
(function() {
var self = uki.theme = {
    themes: [],

    register: function(theme, /* internal */ themes) {
        (themes = self.themes)[ themes.length] = theme;
    },

    background: function(name, params) {
        return self._namedResource(name, 'background', params) || new uki.background.Null();
    },

    image: function(name, params) {
        return self._namedResource(name, 'image', params) || new Image();
    },

    imageSrc: function(name, params) {
        return self._namedResource(name, 'imageSrc', params) || '';
    },

    style: function(name, params) {
        return self._namedResource(name, 'style', params) || '';
    },

    dom: function(name, params) {
        return self._namedResource(name, 'dom', params) || uki.createElement('div');
    },

    template: function(name, params) {
        return self._namedResource(name, 'template', params) || '';
    },

    _namedResource: function(name, type, params, i, result) {
        for ( i = self.themes.length - 1 ; i >= 0; i--) {
            if (result = (self.themes[i] [type](name, params)))
				return result;
        };
        return null;
    }
};
})();

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uki-1.1.4 frameworks/uki/src/uki-core/theme.js
uki-1.1.3 frameworks/uki/src/uki-core/theme.js
uki-1.1.2 frameworks/uki/src/uki-core/theme.js