michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: "use strict"; michael@0: michael@0: module.metadata = { michael@0: "stability": "unstable" michael@0: }; michael@0: michael@0: const ON_PREFIX = "on"; michael@0: const TAB_PREFIX = "Tab"; michael@0: michael@0: const EVENTS = { michael@0: ready: "DOMContentLoaded", michael@0: load: "load", // Used for non-HTML content michael@0: pageshow: "pageshow", // Used for cached content michael@0: open: "TabOpen", michael@0: close: "TabClose", michael@0: activate: "TabSelect", michael@0: deactivate: null, michael@0: pinned: "TabPinned", michael@0: unpinned: "TabUnpinned" michael@0: } michael@0: exports.EVENTS = EVENTS; michael@0: michael@0: Object.keys(EVENTS).forEach(function(name) { michael@0: EVENTS[name] = { michael@0: name: name, michael@0: listener: createListenerName(name), michael@0: dom: EVENTS[name] michael@0: } michael@0: }); michael@0: michael@0: function createListenerName (name) { michael@0: if (name === 'pageshow') michael@0: return 'onPageShow'; michael@0: else michael@0: return ON_PREFIX + name.charAt(0).toUpperCase() + name.substr(1); michael@0: }