暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.cjs.js 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. 'use strict';
  2. var firebase = require('@firebase/app-compat');
  3. var component = require('@firebase/component');
  4. var remoteConfig = require('@firebase/remote-config');
  5. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  6. var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
  7. /**
  8. * @license
  9. * Copyright 2020 Google LLC
  10. *
  11. * Licensed under the Apache License, Version 2.0 (the "License");
  12. * you may not use this file except in compliance with the License.
  13. * You may obtain a copy of the License at
  14. *
  15. * http://www.apache.org/licenses/LICENSE-2.0
  16. *
  17. * Unless required by applicable law or agreed to in writing, software
  18. * distributed under the License is distributed on an "AS IS" BASIS,
  19. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. * See the License for the specific language governing permissions and
  21. * limitations under the License.
  22. */
  23. var RemoteConfigCompatImpl = /** @class */ (function () {
  24. function RemoteConfigCompatImpl(app, _delegate) {
  25. this.app = app;
  26. this._delegate = _delegate;
  27. }
  28. Object.defineProperty(RemoteConfigCompatImpl.prototype, "defaultConfig", {
  29. get: function () {
  30. return this._delegate.defaultConfig;
  31. },
  32. set: function (value) {
  33. this._delegate.defaultConfig = value;
  34. },
  35. enumerable: false,
  36. configurable: true
  37. });
  38. Object.defineProperty(RemoteConfigCompatImpl.prototype, "fetchTimeMillis", {
  39. get: function () {
  40. return this._delegate.fetchTimeMillis;
  41. },
  42. enumerable: false,
  43. configurable: true
  44. });
  45. Object.defineProperty(RemoteConfigCompatImpl.prototype, "lastFetchStatus", {
  46. get: function () {
  47. return this._delegate.lastFetchStatus;
  48. },
  49. enumerable: false,
  50. configurable: true
  51. });
  52. Object.defineProperty(RemoteConfigCompatImpl.prototype, "settings", {
  53. get: function () {
  54. return this._delegate.settings;
  55. },
  56. set: function (value) {
  57. this._delegate.settings = value;
  58. },
  59. enumerable: false,
  60. configurable: true
  61. });
  62. RemoteConfigCompatImpl.prototype.activate = function () {
  63. return remoteConfig.activate(this._delegate);
  64. };
  65. RemoteConfigCompatImpl.prototype.ensureInitialized = function () {
  66. return remoteConfig.ensureInitialized(this._delegate);
  67. };
  68. /**
  69. * @throws a {@link ErrorCode.FETCH_CLIENT_TIMEOUT} if the request takes longer than
  70. * {@link Settings.fetchTimeoutInSeconds} or
  71. * {@link DEFAULT_FETCH_TIMEOUT_SECONDS}.
  72. */
  73. RemoteConfigCompatImpl.prototype.fetch = function () {
  74. return remoteConfig.fetchConfig(this._delegate);
  75. };
  76. RemoteConfigCompatImpl.prototype.fetchAndActivate = function () {
  77. return remoteConfig.fetchAndActivate(this._delegate);
  78. };
  79. RemoteConfigCompatImpl.prototype.getAll = function () {
  80. return remoteConfig.getAll(this._delegate);
  81. };
  82. RemoteConfigCompatImpl.prototype.getBoolean = function (key) {
  83. return remoteConfig.getBoolean(this._delegate, key);
  84. };
  85. RemoteConfigCompatImpl.prototype.getNumber = function (key) {
  86. return remoteConfig.getNumber(this._delegate, key);
  87. };
  88. RemoteConfigCompatImpl.prototype.getString = function (key) {
  89. return remoteConfig.getString(this._delegate, key);
  90. };
  91. RemoteConfigCompatImpl.prototype.getValue = function (key) {
  92. return remoteConfig.getValue(this._delegate, key);
  93. };
  94. // Based on packages/firestore/src/util/log.ts but not static because we need per-instance levels
  95. // to differentiate 2p and 3p use-cases.
  96. RemoteConfigCompatImpl.prototype.setLogLevel = function (logLevel) {
  97. remoteConfig.setLogLevel(this._delegate, logLevel);
  98. };
  99. return RemoteConfigCompatImpl;
  100. }());
  101. var name = "@firebase/remote-config-compat";
  102. var version = "0.2.1";
  103. /**
  104. * @license
  105. * Copyright 2020 Google LLC
  106. *
  107. * Licensed under the Apache License, Version 2.0 (the "License");
  108. * you may not use this file except in compliance with the License.
  109. * You may obtain a copy of the License at
  110. *
  111. * http://www.apache.org/licenses/LICENSE-2.0
  112. *
  113. * Unless required by applicable law or agreed to in writing, software
  114. * distributed under the License is distributed on an "AS IS" BASIS,
  115. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  116. * See the License for the specific language governing permissions and
  117. * limitations under the License.
  118. */
  119. function registerRemoteConfigCompat(firebaseInstance) {
  120. firebaseInstance.INTERNAL.registerComponent(new component.Component('remoteConfig-compat', remoteConfigFactory, "PUBLIC" /* ComponentType.PUBLIC */)
  121. .setMultipleInstances(true)
  122. .setServiceProps({ isSupported: remoteConfig.isSupported }));
  123. firebaseInstance.registerVersion(name, version);
  124. }
  125. function remoteConfigFactory(container, _a) {
  126. var namespace = _a.instanceIdentifier;
  127. var app = container.getProvider('app-compat').getImmediate();
  128. // The following call will always succeed because rc `import {...} from '@firebase/remote-config'`
  129. var remoteConfig = container.getProvider('remote-config').getImmediate({
  130. identifier: namespace
  131. });
  132. return new RemoteConfigCompatImpl(app, remoteConfig);
  133. }
  134. registerRemoteConfigCompat(firebase__default["default"]);
  135. //# sourceMappingURL=index.cjs.js.map