园林绿化
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.

779 lines
26 KiB

  1. //兼容1.92(2022-4-2)删除的方法
  2. //还需要手动修改 Cesium\Workers\when-8d13db60.js
  3. // import { c as createCommonjsModule } from './_commonjsHelpers-3aae1032.js';
  4. function createCommonjsModule(fn, basedir, module) {
  5. return (
  6. (module = {
  7. path: basedir,
  8. exports: {},
  9. require: function (path, base) {
  10. return commonjsRequire(path, base === undefined || base === null ? module.path : base);
  11. },
  12. }),
  13. fn(module, module.exports),
  14. module.exports
  15. );
  16. }
  17. var when = createCommonjsModule(function (module, exports) {
  18. /** @license MIT License (c) copyright B Cavalier & J Hann */
  19. /**
  20. * A lightweight CommonJS Promises/A and when() implementation
  21. * when is part of the cujo.js family of libraries (http://cujojs.com/)
  22. *
  23. * Licensed under the MIT License at:
  24. * http://www.opensource.org/licenses/mit-license.php
  25. *
  26. * @version 1.7.1
  27. */
  28. (function (define) {
  29. define(function () {
  30. var reduceArray, slice, undef;
  31. //
  32. // Public API
  33. //
  34. when.defer = defer; // Create a deferred
  35. when.resolve = resolve; // Create a resolved promise
  36. when.reject = reject; // Create a rejected promise
  37. when.join = join; // Join 2 or more promises
  38. when.all = all; // Resolve a list of promises
  39. when.map = map; // Array.map() for promises
  40. when.reduce = reduce; // Array.reduce() for promises
  41. when.any = any; // One-winner race
  42. when.some = some; // Multi-winner race
  43. when.chain = chain; // Make a promise trigger another resolver
  44. when.isPromise = isPromise; // Determine if a thing is a promise
  45. /**
  46. * Register an observer for a promise or immediate value.
  47. *
  48. * @param {*} promiseOrValue
  49. * @param {function?} [onFulfilled] callback to be called when promiseOrValue is
  50. * successfully fulfilled. If promiseOrValue is an immediate value, callback
  51. * will be invoked immediately.
  52. * @param {function?} [onRejected] callback to be called when promiseOrValue is
  53. * rejected.
  54. * @param {function?} [onProgress] callback to be called when progress updates
  55. * are issued for promiseOrValue.
  56. * @returns {Promise} a new {@link Promise} that will complete with the return
  57. * value of callback or errback or the completion value of promiseOrValue if
  58. * callback and/or errback is not supplied.
  59. */
  60. function when(promiseOrValue, onFulfilled, onRejected, onProgress) {
  61. // Get a trusted promise for the input promiseOrValue, and then
  62. // register promise handlers
  63. return resolve(promiseOrValue).then(onFulfilled, onRejected, onProgress);
  64. }
  65. /**
  66. * Returns promiseOrValue if promiseOrValue is a {@link Promise}, a new Promise if
  67. * promiseOrValue is a foreign promise, or a new, already-fulfilled {@link Promise}
  68. * whose value is promiseOrValue if promiseOrValue is an immediate value.
  69. *
  70. * @param {*} promiseOrValue
  71. * @returns Guaranteed to return a trusted Promise. If promiseOrValue is a when.js {@link Promise}
  72. * returns promiseOrValue, otherwise, returns a new, already-resolved, when.js {@link Promise}
  73. * whose resolution value is:
  74. * * the resolution value of promiseOrValue if it's a foreign promise, or
  75. * * promiseOrValue if it's a value
  76. */
  77. function resolve(promiseOrValue) {
  78. var promise, deferred;
  79. if (promiseOrValue instanceof Promise) {
  80. // It's a when.js promise, so we trust it
  81. promise = promiseOrValue;
  82. } else {
  83. // It's not a when.js promise. See if it's a foreign promise or a value.
  84. if (isPromise(promiseOrValue)) {
  85. // It's a thenable, but we don't know where it came from, so don't trust
  86. // its implementation entirely. Introduce a trusted middleman when.js promise
  87. deferred = defer();
  88. // IMPORTANT: This is the only place when.js should ever call .then() on an
  89. // untrusted promise. Don't expose the return value to the untrusted promise
  90. promiseOrValue.then(
  91. function (value) {
  92. deferred.resolve(value);
  93. },
  94. function (reason) {
  95. deferred.reject(reason);
  96. },
  97. function (update) {
  98. deferred.progress(update);
  99. }
  100. );
  101. promise = deferred.promise;
  102. } else {
  103. // It's a value, not a promise. Create a resolved promise for it.
  104. promise = fulfilled(promiseOrValue);
  105. }
  106. }
  107. return promise;
  108. }
  109. /**
  110. * Returns a rejected promise for the supplied promiseOrValue. The returned
  111. * promise will be rejected with:
  112. * - promiseOrValue, if it is a value, or
  113. * - if promiseOrValue is a promise
  114. * - promiseOrValue's value after it is fulfilled
  115. * - promiseOrValue's reason after it is rejected
  116. * @param {*} promiseOrValue the rejected value of the returned {@link Promise}
  117. * @return {Promise} rejected {@link Promise}
  118. */
  119. function reject(promiseOrValue) {
  120. return when(promiseOrValue, rejected);
  121. }
  122. /**
  123. * Trusted Promise constructor. A Promise created from this constructor is
  124. * a trusted when.js promise. Any other duck-typed promise is considered
  125. * untrusted.
  126. * @constructor
  127. * @name Promise
  128. */
  129. function Promise(then) {
  130. this.then = then;
  131. }
  132. Promise.prototype = {
  133. /**
  134. * Register a callback that will be called when a promise is
  135. * fulfilled or rejected. Optionally also register a progress handler.
  136. * Shortcut for .then(onFulfilledOrRejected, onFulfilledOrRejected, onProgress)
  137. * @param {function?} [onFulfilledOrRejected]
  138. * @param {function?} [onProgress]
  139. * @return {Promise}
  140. */
  141. always: function (onFulfilledOrRejected, onProgress) {
  142. return this.then(onFulfilledOrRejected, onFulfilledOrRejected, onProgress);
  143. },
  144. finally: function (onFulfilledOrRejected, onProgress) {
  145. return this.then(onFulfilledOrRejected, onFulfilledOrRejected, onProgress);
  146. },
  147. /**
  148. * Register a rejection handler. Shortcut for .then(undefined, onRejected)
  149. * @param {function?} onRejected
  150. * @return {Promise}
  151. */
  152. otherwise: function (onRejected) {
  153. return this.then(undef, onRejected);
  154. },
  155. catch: function (onRejected) {
  156. return this.then(undef, onRejected);
  157. },
  158. /**
  159. * Shortcut for .then(function() { return value; })
  160. * @param {*} value
  161. * @return {Promise} a promise that:
  162. * - is fulfilled if value is not a promise, or
  163. * - if value is a promise, will fulfill with its value, or reject
  164. * with its reason.
  165. */
  166. yield: function (value) {
  167. return this.then(function () {
  168. return value;
  169. });
  170. },
  171. /**
  172. * Assumes that this promise will fulfill with an array, and arranges
  173. * for the onFulfilled to be called with the array as its argument list
  174. * i.e. onFulfilled.spread(undefined, array).
  175. * @param {function} onFulfilled function to receive spread arguments
  176. * @return {Promise}
  177. */
  178. spread: function (onFulfilled) {
  179. return this.then(function (array) {
  180. // array may contain promises, so resolve its contents.
  181. return all(array, function (array) {
  182. return onFulfilled.apply(undef, array);
  183. });
  184. });
  185. },
  186. };
  187. /**
  188. * Create an already-resolved promise for the supplied value
  189. * @private
  190. *
  191. * @param {*} value
  192. * @return {Promise} fulfilled promise
  193. */
  194. function fulfilled(value) {
  195. var p = new Promise(function (onFulfilled) {
  196. // TODO: Promises/A+ check typeof onFulfilled
  197. try {
  198. return resolve(onFulfilled ? onFulfilled(value) : value);
  199. } catch (e) {
  200. return rejected(e);
  201. }
  202. });
  203. return p;
  204. }
  205. /**
  206. * Create an already-rejected {@link Promise} with the supplied
  207. * rejection reason.
  208. * @private
  209. *
  210. * @param {*} reason
  211. * @return {Promise} rejected promise
  212. */
  213. function rejected(reason) {
  214. var p = new Promise(function (_, onRejected) {
  215. // TODO: Promises/A+ check typeof onRejected
  216. try {
  217. return onRejected ? resolve(onRejected(reason)) : rejected(reason);
  218. } catch (e) {
  219. return rejected(e);
  220. }
  221. });
  222. return p;
  223. }
  224. /**
  225. * Creates a new, Deferred with fully isolated resolver and promise parts,
  226. * either or both of which may be given out safely to consumers.
  227. * The Deferred itself has the full API: resolve, reject, progress, and
  228. * then. The resolver has resolve, reject, and progress. The promise
  229. * only has then.
  230. *
  231. * @return {Deferred}
  232. */
  233. function defer() {
  234. var deferred, promise, handlers, progressHandlers, _then, _progress, _resolve;
  235. /**
  236. * The promise for the new deferred
  237. * @type {Promise}
  238. */
  239. promise = new Promise(then);
  240. /**
  241. * The full Deferred object, with {@link Promise} and {@link Resolver} parts
  242. * @class Deferred
  243. * @name Deferred
  244. */
  245. deferred = {
  246. then: then, // DEPRECATED: use deferred.promise.then
  247. resolve: promiseResolve,
  248. reject: promiseReject,
  249. // TODO: Consider renaming progress() to notify()
  250. progress: promiseProgress,
  251. promise: promise,
  252. resolver: {
  253. resolve: promiseResolve,
  254. reject: promiseReject,
  255. progress: promiseProgress,
  256. },
  257. };
  258. handlers = [];
  259. progressHandlers = [];
  260. /**
  261. * Pre-resolution then() that adds the supplied callback, errback, and progback
  262. * functions to the registered listeners
  263. * @private
  264. *
  265. * @param {function?} [onFulfilled] resolution handler
  266. * @param {function?} [onRejected] rejection handler
  267. * @param {function?} [onProgress] progress handler
  268. */
  269. _then = function (onFulfilled, onRejected, onProgress) {
  270. // TODO: Promises/A+ check typeof onFulfilled, onRejected, onProgress
  271. var deferred, progressHandler;
  272. deferred = defer();
  273. progressHandler =
  274. typeof onProgress === "function"
  275. ? function (update) {
  276. try {
  277. // Allow progress handler to transform progress event
  278. deferred.progress(onProgress(update));
  279. } catch (e) {
  280. // Use caught value as progress
  281. deferred.progress(e);
  282. }
  283. }
  284. : function (update) {
  285. deferred.progress(update);
  286. };
  287. handlers.push(function (promise) {
  288. promise.then(onFulfilled, onRejected).then(deferred.resolve, deferred.reject, progressHandler);
  289. });
  290. progressHandlers.push(progressHandler);
  291. return deferred.promise;
  292. };
  293. /**
  294. * Issue a progress event, notifying all progress listeners
  295. * @private
  296. * @param {*} update progress event payload to pass to all listeners
  297. */
  298. _progress = function (update) {
  299. processQueue(progressHandlers, update);
  300. return update;
  301. };
  302. /**
  303. * Transition from pre-resolution state to post-resolution state, notifying
  304. * all listeners of the resolution or rejection
  305. * @private
  306. * @param {*} value the value of this deferred
  307. */
  308. _resolve = function (value) {
  309. value = resolve(value);
  310. // Replace _then with one that directly notifies with the result.
  311. _then = value.then;
  312. // Replace _resolve so that this Deferred can only be resolved once
  313. _resolve = resolve;
  314. // Make _progress a noop, to disallow progress for the resolved promise.
  315. _progress = noop;
  316. // Notify handlers
  317. processQueue(handlers, value);
  318. // Free progressHandlers array since we'll never issue progress events
  319. progressHandlers = handlers = undef;
  320. return value;
  321. };
  322. return deferred;
  323. /**
  324. * Wrapper to allow _then to be replaced safely
  325. * @param {function?} [onFulfilled] resolution handler
  326. * @param {function?} [onRejected] rejection handler
  327. * @param {function?} [onProgress] progress handler
  328. * @return {Promise} new promise
  329. */
  330. function then(onFulfilled, onRejected, onProgress) {
  331. // TODO: Promises/A+ check typeof onFulfilled, onRejected, onProgress
  332. return _then(onFulfilled, onRejected, onProgress);
  333. }
  334. /**
  335. * Wrapper to allow _resolve to be replaced
  336. */
  337. function promiseResolve(val) {
  338. return _resolve(val);
  339. }
  340. /**
  341. * Wrapper to allow _reject to be replaced
  342. */
  343. function promiseReject(err) {
  344. return _resolve(rejected(err));
  345. }
  346. /**
  347. * Wrapper to allow _progress to be replaced
  348. */
  349. function promiseProgress(update) {
  350. return _progress(update);
  351. }
  352. }
  353. /**
  354. * Determines if promiseOrValue is a promise or not. Uses the feature
  355. * test from http://wiki.commonjs.org/wiki/Promises/A to determine if
  356. * promiseOrValue is a promise.
  357. *
  358. * @param {*} promiseOrValue anything
  359. * @returns {boolean} true if promiseOrValue is a {@link Promise}
  360. */
  361. function isPromise(promiseOrValue) {
  362. return promiseOrValue && typeof promiseOrValue.then === "function";
  363. }
  364. /**
  365. * Initiates a competitive race, returning a promise that will resolve when
  366. * howMany of the supplied promisesOrValues have resolved, or will reject when
  367. * it becomes impossible for howMany to resolve, for example, when
  368. * (promisesOrValues.length - howMany) + 1 input promises reject.
  369. *
  370. * @param {Array} promisesOrValues array of anything, may contain a mix
  371. * of promises and values
  372. * @param howMany {number} number of promisesOrValues to resolve
  373. * @param {function?} [onFulfilled] resolution handler
  374. * @param {function?} [onRejected] rejection handler
  375. * @param {function?} [onProgress] progress handler
  376. * @returns {Promise} promise that will resolve to an array of howMany values that
  377. * resolved first, or will reject with an array of (promisesOrValues.length - howMany) + 1
  378. * rejection reasons.
  379. */
  380. function some(promisesOrValues, howMany, onFulfilled, onRejected, onProgress) {
  381. checkCallbacks(2, arguments);
  382. return when(promisesOrValues, function (promisesOrValues) {
  383. var toResolve, toReject, values, reasons, deferred, fulfillOne, rejectOne, progress, len, i;
  384. len = promisesOrValues.length >>> 0;
  385. toResolve = Math.max(0, Math.min(howMany, len));
  386. values = [];
  387. toReject = len - toResolve + 1;
  388. reasons = [];
  389. deferred = defer();
  390. // No items in the input, resolve immediately
  391. if (!toResolve) {
  392. deferred.resolve(values);
  393. } else {
  394. progress = deferred.progress;
  395. rejectOne = function (reason) {
  396. reasons.push(reason);
  397. if (!--toReject) {
  398. fulfillOne = rejectOne = noop;
  399. deferred.reject(reasons);
  400. }
  401. };
  402. fulfillOne = function (val) {
  403. // This orders the values based on promise resolution order
  404. // Another strategy would be to use the original position of
  405. // the corresponding promise.
  406. values.push(val);
  407. if (!--toResolve) {
  408. fulfillOne = rejectOne = noop;
  409. deferred.resolve(values);
  410. }
  411. };
  412. for (i = 0; i < len; ++i) {
  413. if (i in promisesOrValues) {
  414. when(promisesOrValues[i], fulfiller, rejecter, progress);
  415. }
  416. }
  417. }
  418. return deferred.then(onFulfilled, onRejected, onProgress);
  419. function rejecter(reason) {
  420. rejectOne(reason);
  421. }
  422. function fulfiller(val) {
  423. fulfillOne(val);
  424. }
  425. });
  426. }
  427. /**
  428. * Initiates a competitive race, returning a promise that will resolve when
  429. * any one of the supplied promisesOrValues has resolved or will reject when
  430. * *all* promisesOrValues have rejected.
  431. *
  432. * @param {Array|Promise} promisesOrValues array of anything, may contain a mix
  433. * of {@link Promise}s and values
  434. * @param {function?} [onFulfilled] resolution handler
  435. * @param {function?} [onRejected] rejection handler
  436. * @param {function?} [onProgress] progress handler
  437. * @returns {Promise} promise that will resolve to the value that resolved first, or
  438. * will reject with an array of all rejected inputs.
  439. */
  440. function any(promisesOrValues, onFulfilled, onRejected, onProgress) {
  441. function unwrapSingleResult(val) {
  442. return onFulfilled ? onFulfilled(val[0]) : val[0];
  443. }
  444. return some(promisesOrValues, 1, unwrapSingleResult, onRejected, onProgress);
  445. }
  446. /**
  447. * Return a promise that will resolve only once all the supplied promisesOrValues
  448. * have resolved. The resolution value of the returned promise will be an array
  449. * containing the resolution values of each of the promisesOrValues.
  450. * @memberOf when
  451. *
  452. * @param {Array|Promise} promisesOrValues array of anything, may contain a mix
  453. * of {@link Promise}s and values
  454. * @param {function?} [onFulfilled] resolution handler
  455. * @param {function?} [onRejected] rejection handler
  456. * @param {function?} [onProgress] progress handler
  457. * @returns {Promise}
  458. */
  459. function all(promisesOrValues, onFulfilled, onRejected, onProgress) {
  460. checkCallbacks(1, arguments);
  461. return map(promisesOrValues, identity).then(onFulfilled, onRejected, onProgress);
  462. }
  463. /**
  464. * Joins multiple promises into a single returned promise.
  465. * @return {Promise} a promise that will fulfill when *all* the input promises
  466. * have fulfilled, or will reject when *any one* of the input promises rejects.
  467. */
  468. function join(/* ...promises */) {
  469. return map(arguments, identity);
  470. }
  471. /**
  472. * Traditional map function, similar to `Array.prototype.map()`, but allows
  473. * input to contain {@link Promise}s and/or values, and mapFunc may return
  474. * either a value or a {@link Promise}
  475. *
  476. * @param {Array|Promise} promise array of anything, may contain a mix
  477. * of {@link Promise}s and values
  478. * @param {function} mapFunc mapping function mapFunc(value) which may return
  479. * either a {@link Promise} or value
  480. * @returns {Promise} a {@link Promise} that will resolve to an array containing
  481. * the mapped output values.
  482. */
  483. function map(promise, mapFunc) {
  484. return when(promise, function (array) {
  485. var results, len, toResolve, resolve, i, d;
  486. // Since we know the resulting length, we can preallocate the results
  487. // array to avoid array expansions.
  488. toResolve = len = array.length >>> 0;
  489. results = [];
  490. d = defer();
  491. if (!toResolve) {
  492. d.resolve(results);
  493. } else {
  494. resolve = function resolveOne(item, i) {
  495. when(item, mapFunc).then(function (mapped) {
  496. results[i] = mapped;
  497. if (!--toResolve) {
  498. d.resolve(results);
  499. }
  500. }, d.reject);
  501. };
  502. // Since mapFunc may be async, get all invocations of it into flight
  503. for (i = 0; i < len; i++) {
  504. if (i in array) {
  505. resolve(array[i], i);
  506. } else {
  507. --toResolve;
  508. }
  509. }
  510. }
  511. return d.promise;
  512. });
  513. }
  514. /**
  515. * Traditional reduce function, similar to `Array.prototype.reduce()`, but
  516. * input may contain promises and/or values, and reduceFunc
  517. * may return either a value or a promise, *and* initialValue may
  518. * be a promise for the starting value.
  519. *
  520. * @param {Array|Promise} promise array or promise for an array of anything,
  521. * may contain a mix of promises and values.
  522. * @param {function} reduceFunc reduce function reduce(currentValue, nextValue, index, total),
  523. * where total is the total number of items being reduced, and will be the same
  524. * in each call to reduceFunc.
  525. * @returns {Promise} that will resolve to the final reduced value
  526. */
  527. function reduce(promise, reduceFunc /*, initialValue */) {
  528. var args = slice.call(arguments, 1);
  529. return when(promise, function (array) {
  530. var total;
  531. total = array.length;
  532. // Wrap the supplied reduceFunc with one that handles promises and then
  533. // delegates to the supplied.
  534. args[0] = function (current, val, i) {
  535. return when(current, function (c) {
  536. return when(val, function (value) {
  537. return reduceFunc(c, value, i, total);
  538. });
  539. });
  540. };
  541. return reduceArray.apply(array, args);
  542. });
  543. }
  544. /**
  545. * Ensure that resolution of promiseOrValue will trigger resolver with the
  546. * value or reason of promiseOrValue, or instead with resolveValue if it is provided.
  547. *
  548. * @param promiseOrValue
  549. * @param {Object} resolver
  550. * @param {function} resolver.resolve
  551. * @param {function} resolver.reject
  552. * @param {*} [resolveValue]
  553. * @returns {Promise}
  554. */
  555. function chain(promiseOrValue, resolver, resolveValue) {
  556. var useResolveValue = arguments.length > 2;
  557. return when(
  558. promiseOrValue,
  559. function (val) {
  560. val = useResolveValue ? resolveValue : val;
  561. resolver.resolve(val);
  562. return val;
  563. },
  564. function (reason) {
  565. resolver.reject(reason);
  566. return rejected(reason);
  567. },
  568. resolver.progress
  569. );
  570. }
  571. //
  572. // Utility functions
  573. //
  574. /**
  575. * Apply all functions in queue to value
  576. * @param {Array} queue array of functions to execute
  577. * @param {*} value argument passed to each function
  578. */
  579. function processQueue(queue, value) {
  580. var handler,
  581. i = 0;
  582. while ((handler = queue[i++])) {
  583. handler(value);
  584. }
  585. }
  586. /**
  587. * Helper that checks arrayOfCallbacks to ensure that each element is either
  588. * a function, or null or undefined.
  589. * @private
  590. * @param {number} start index at which to start checking items in arrayOfCallbacks
  591. * @param {Array} arrayOfCallbacks array to check
  592. * @throws {Error} if any element of arrayOfCallbacks is something other than
  593. * a functions, null, or undefined.
  594. */
  595. function checkCallbacks(start, arrayOfCallbacks) {
  596. // TODO: Promises/A+ update type checking and docs
  597. var arg,
  598. i = arrayOfCallbacks.length;
  599. while (i > start) {
  600. arg = arrayOfCallbacks[--i];
  601. if (arg != null && typeof arg != "function") {
  602. throw new Error("arg " + i + " must be a function");
  603. }
  604. }
  605. }
  606. /**
  607. * No-Op function used in method replacement
  608. * @private
  609. */
  610. function noop() {}
  611. slice = [].slice;
  612. // ES5 reduce implementation if native not available
  613. // See: http://es5.github.com/#x15.4.4.21 as there are many
  614. // specifics and edge cases.
  615. reduceArray =
  616. [].reduce ||
  617. function (reduceFunc /*, initialValue */) {
  618. /*jshint maxcomplexity: 7*/
  619. // ES5 dictates that reduce.length === 1
  620. // This implementation deviates from ES5 spec in the following ways:
  621. // 1. It does not check if reduceFunc is a Callable
  622. var arr, args, reduced, len, i;
  623. i = 0;
  624. // This generates a jshint warning, despite being valid
  625. // "Missing 'new' prefix when invoking a constructor."
  626. // See https://github.com/jshint/jshint/issues/392
  627. arr = Object(this);
  628. len = arr.length >>> 0;
  629. args = arguments;
  630. // If no initialValue, use first item of array (we know length !== 0 here)
  631. // and adjust i to start at second item
  632. if (args.length <= 1) {
  633. // Skip to the first real element in the array
  634. for (;;) {
  635. if (i in arr) {
  636. reduced = arr[i++];
  637. break;
  638. }
  639. // If we reached the end of the array without finding any real
  640. // elements, it's a TypeError
  641. if (++i >= len) {
  642. throw new TypeError();
  643. }
  644. }
  645. } else {
  646. // If initialValue provided, use it
  647. reduced = args[1];
  648. }
  649. // Do the actual reduce
  650. for (; i < len; ++i) {
  651. // Skip holes
  652. if (i in arr) {
  653. reduced = reduceFunc(reduced, arr[i], i, arr);
  654. }
  655. }
  656. return reduced;
  657. };
  658. function identity(x) {
  659. return x;
  660. }
  661. return when;
  662. });
  663. })(
  664. function (factory) {
  665. module.exports = factory();
  666. }
  667. // Boilerplate for AMD, Node, and browser global
  668. );
  669. });
  670. //兼容v1.92版本以前的cesium
  671. Cesium.when= Cesium.when||{}
  672. Cesium.when.defer = when.defer;
  673. Cesium.when = when
  674. Cesium.defer = when.defer;
  675. //兼容1.92以后的cesium相关插件
  676. Promise.prototype.otherwise = Promise.prototype.catch;
  677. Promise.prototype.always = Promise.prototype.finally;