34 lines
837 B
JavaScript
34 lines
837 B
JavaScript
// Registry used by the player runtime to discover independently loaded region modules.
|
|
|
|
(function () {
|
|
var root = window;
|
|
var registry = root.pulsePlayerRegionTypes && typeof root.pulsePlayerRegionTypes === 'object' ? root.pulsePlayerRegionTypes : {};
|
|
|
|
function normalizeType(type) {
|
|
return String(type || '').trim().toLowerCase();
|
|
}
|
|
|
|
function register(type, definition) {
|
|
registry[normalizeType(type)] = definition || {};
|
|
return registry[normalizeType(type)];
|
|
}
|
|
|
|
function get(type) {
|
|
return registry[normalizeType(type)] || null;
|
|
}
|
|
|
|
function list() {
|
|
return Object.keys(registry).map(function (type) {
|
|
return {
|
|
type: type,
|
|
definition: registry[type] || {}
|
|
};
|
|
});
|
|
}
|
|
|
|
root.pulsePlayerRegionTypes = {
|
|
register: register,
|
|
get: get,
|
|
list: list
|
|
};
|
|
}()); |