addon-sdk/source/lib/sdk/tabs/common.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/addon-sdk/source/lib/sdk/tabs/common.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,29 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +'use strict';
     1.8 +
     1.9 +const { validateOptions } = require('../deprecated/api-utils');
    1.10 +
    1.11 +function Options(options) {
    1.12 +  if ('string' === typeof options)
    1.13 +    options = { url: options };
    1.14 +
    1.15 +  return validateOptions(options, {
    1.16 +    url: { is: ["string"] },
    1.17 +    inBackground: {
    1.18 +      map: function(v) !!v,
    1.19 +      is: ["undefined", "boolean"]
    1.20 +    },
    1.21 +    isPinned: { is: ["undefined", "boolean"] },
    1.22 +    isPrivate: { is: ["undefined", "boolean"] },
    1.23 +    onOpen: { is: ["undefined", "function"] },
    1.24 +    onClose: { is: ["undefined", "function"] },
    1.25 +    onReady: { is: ["undefined", "function"] },
    1.26 +    onLoad: { is: ["undefined", "function"] },
    1.27 +    onPageShow: { is: ["undefined", "function"] },
    1.28 +    onActivate: { is: ["undefined", "function"] },
    1.29 +    onDeactivate: { is: ["undefined", "function"] }
    1.30 +  });
    1.31 +}
    1.32 +exports.Options = Options;

mercurial