require(['dojo/_base/declare', 'dojo/_base/lang', 'dojo/_base/array'], function (declare, lang, array) { var Blinker = declare(null, { constructor: function (graphics, interval) { this.graphics = graphics || []; this.interval = interval || 1000; }, _interval: null, blink: function () { array.forEach(this.graphics, function (graphic) { return graphic.visible ? graphic.hide() : graphic.show(); }); }, start: function () { this._interval = setInterval(lang.hitch(this, 'blink'), this.interval); return this; }, stop: function () { return this._interval && clearInterval(this._interval); } }); /** * * @param {FeatureLayer} layer feature layer whos selection should be blinking * @param {Number} [interval] millisecond delay for blink * @example * // start blinking * var blinker = Blinker.blinkSelectedFeatures(myFeatureLayer, 2000); * * // stop blinking * blinker.stop(); * @returns {*} */ Blinker.blinkSelectedFeatures = function (/* FeatureLayer */ layer,/* number */ interval) { return new Blinker(layer.getSelectedFeatures(), interval).start(); // Blinker }; });
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.