common.js 1012 B

1234567891011121314151617181920212223242526272829
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. 'use strict';
  5. const { validateOptions } = require('../deprecated/api-utils');
  6. function Options(options) {
  7. if ('string' === typeof options)
  8. options = { url: options };
  9. return validateOptions(options, {
  10. url: { is: ["string"] },
  11. inBackground: {
  12. map: function(v) !!v,
  13. is: ["undefined", "boolean"]
  14. },
  15. isPinned: { is: ["undefined", "boolean"] },
  16. isPrivate: { is: ["undefined", "boolean"] },
  17. onOpen: { is: ["undefined", "function"] },
  18. onClose: { is: ["undefined", "function"] },
  19. onReady: { is: ["undefined", "function"] },
  20. onLoad: { is: ["undefined", "function"] },
  21. onPageShow: { is: ["undefined", "function"] },
  22. onActivate: { is: ["undefined", "function"] },
  23. onDeactivate: { is: ["undefined", "function"] }
  24. });
  25. }
  26. exports.Options = Options;