예제 #1
0
        private void DoReplayChanges()
        {
            if (QueueIsEmpty)
            {
                return;
            }

            var from = _First;

            _JsUpdaterFactory.CheckUiContext();

            bool Or(bool value, bool res) => res || value;

            bool UpdateNeedToRunOnJsContext(IJavascriptUpdater updater)
            {
                updater.OnUiContext(Off);
                return(updater.NeedToRunOnJsContext);
            }

            var needUpdateOnJsContext = from.Reduce(UpdateNeedToRunOnJsContext, Or);

            ResetQueue();
            if (!needUpdateOnJsContext)
            {
                return;
            }

            void PerformOnJsContext(IJavascriptUpdater updater)
            {
                if (!updater.NeedToRunOnJsContext)
                {
                    return;
                }
                updater.OnJsContext();
            }

            _JsUpdaterFactory.DispatchInJavascriptContext(() =>
            {
                @from.ForEach(PerformOnJsContext);
            });
        }
        private void DoReplayChanges()
        {
            if (QueueIsEmpty)
            {
                return;
            }

            _JsUpdaterFactory.CheckUiContext();

            IJavascriptJsContextUpdater ExecuteOnUiContext(IJavascriptUIContextUpdater updater) => updater.ExecuteOnUiContext(Off);

            var jsContextUpdated = _First.MapFilter(ExecuteOnUiContext, up => up != null);

            ResetQueue();
            if (jsContextUpdated == null)
            {
                return;
            }

            _JsUpdaterFactory.DispatchInJavascriptContext(() => jsContextUpdated.ForEach(updater => updater.ExecuteOnJsContext()));
        }