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 }; });
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.