|
22 | 22 | \usepackage{pgfplots} |
23 | 23 | \pgfplotsset{compat=newest} % Allows to place the legend below plot |
24 | 24 | \usepgfplotslibrary{units} % Allows to enter the units nicely |
25 | | -\usepackage{todonotes} |
| 25 | +\usepackage[disable]{todonotes} |
26 | 26 | \usepackage[toc,acronym]{glossaries} |
27 | 27 | \makenoidxglossaries |
28 | 28 | % \makeglossaries |
|
246 | 246 | Sammanfattning ska vara här. |
247 | 247 | \end{foreignabstract} |
248 | 248 | \clearpage |
249 | | - \noindent |
250 | | - \large |
251 | | - The colored rectangles that appear throughout this thesis are comments and feedback (presented as todos), which mean that they are not part of the actual content. |
252 | | - It should be noted that all named todo items are not quotations of the persons that it was received from. |
253 | | - Instead, all todo items represent my own interpretation of the feedback given to me. |
254 | | - \clearpage |
| 249 | + % \noindent |
| 250 | + % \large |
| 251 | + % The colored rectangles that appear throughout this thesis are comments and feedback (presented as todos), which mean that they are not part of the actual content. |
| 252 | + % It should be noted that all named todo items are not quotations of the persons that it was received from. |
| 253 | + % Instead, all todo items represent my own interpretation of the feedback given to me. |
| 254 | + % \clearpage |
255 | 255 | \section*{Acknowledgements} |
256 | 256 | I would like to thank my supervisors Tomas Ekholm, Philipp Haller and Stefan Sennerö for their enthusiastic involvement of this thesis. |
257 | 257 | They have provided me with great feedback and support throughout the project. |
|
285 | 285 | \section{Targeted audience} |
286 | 286 | This thesis is targeted for \gls{web} developers that wish to gain a deeper understanding of element queries and how one could solve the problem today. |
287 | 287 | Heavy use of \gls{web} terminology is being used and intermediate \gls{web} development knowledge is beneficial. |
288 | | - For readers that are not familiar with web terminology there is a glossary at the end of the document. |
| 288 | + For readers that are not familiar with web terminology there is a glossary at the end of this thesis. |
289 | 289 | \todo[inline]{Philipp wanted this to be more general.} |
290 | 290 | \section{Problem statement}\label{sec:problem} |
291 | 291 | By using \gls{CSS} \gls{media queries}, developers can specify different style rules for different \gls{viewport} sizes. |
|
1810 | 1810 | % To avoid \gls{layout thrashing} by other scripts it can beneficial to asynchronously postpone the \glslink{batch processing}{batch} until the next layout cycle of the \gls{browser}, which is also handled by the subsystem. |
1811 | 1811 | Both Section~\ref{sec:layout-process} and \ref{sec:layout-thrashing} is recommended to read in order to understand the optimizations described in this section. |
1812 | 1812 |
|
1813 | | - The batch processor is the foundation for good performace and is therefore used by several subsystems of \gls{ELQ}. |
| 1813 | + The batch processor is the foundation for good performace of the library, and is therefore used by several subsystems. |
1814 | 1814 | It serves two purposes: |
1815 | 1815 | \begin{enumerate} |
1816 | 1816 | \item Automatically process a batch asynchronously. |
1817 | 1817 | \item Process a batch in different levels. |
1818 | 1818 | \end{enumerate} |
1819 | 1819 |
|
1820 | | - The idea is that users may register functions via the \code{add} method. |
1821 | | - The method also accepts an optional level parameter that specified at which level the function should be executed. |
1822 | | - |
1823 | | - \textbf{Batch processor}: via the \code{elq.BatchProcessor} property that refers to a factory function that creates \glslink{batch processing}{batch processor} instances. |
1824 | | - Instead of having a single \glslink{batch processing}{batch processor} instance shared among all library entities (i.e., core subsystems and plugins), each entity has to create an own instance. |
1825 | | - This to avoid entities interfering with each other while processing \glslink{batch processing}{batches}. |
1826 | | - For example, some entities might want to force the \glslink{batch processing}{batch} to be processed at a point where it would be beneficial for other entities to delay the processing. |
1827 | | - The \code{createBatchProcessor} accepts an optional options object parameter and returns a \glslink{batch processing}{batch processor} instance |
1828 | | - Two important options to the \code{createBatchProcessor} are the \code{async} and \code{auto} options. |
| 1820 | + The automated asynchronous processing of batches is important because some subsystems do not know how many operations are to be performed when called. |
| 1821 | + For instance, the public \gls{ELQ} \gls{API} method \code{start} is called with elements to be initiated by the library. |
| 1822 | + As part of the initialization, the element resize detection subsystem may be called that needs to prepare elements to be detectable. |
| 1823 | + This needs to be batch processed, which is possible to do synchronously. |
| 1824 | + However, if the \code{start} method is called mutliple times synchronously layout thrashing occurs since one batch for each method call is created. |
| 1825 | + See listing~\ref{} for example code that invokes the \code{start} method multiple times synchronously. |
| 1826 | + \begin{lstlisting}[gobble=10,label={code:batch-processor-example},caption={Example of multiple synchronous calls to the \gls{ELQ} \code{start} method.},captionpos=b]] |
| 1827 | + elq.start(document.getElementById("...")); |
| 1828 | + elq.start(document.getElementById("...")); |
| 1829 | + elq.start(document.getElementById("...")); |
| 1830 | + |
| 1831 | + var elements = document.querySelectorAll("..."); |
| 1832 | + elements.forEach(elq.start); |
| 1833 | + \end{lstlisting} |
| 1834 | + Of course, such usage could be warned against in the \gls{API} documentation but to keep the \gls{API} as simple as possible another approach has been taken. |
| 1835 | + By delaying the batch to execute asynchronously, on he next JavaScript event tick on most layout engines, all synchronous calls to the method is grouped to the pending batch. |
| 1836 | + This behavior can be controlled by the \code{async} and \code{auto} options of the factory function. |
1829 | 1837 | If the \code{async} option is enabled, the \glslink{batch processing}{batch} will be processed asynchronously as soon as possible after that the \code{force} method has been invoked. |
1830 | 1838 | If the \code{auto} option is enabled, the batch will automatically be processed as soon as possible asynchronously (this implies that \code{async} has to be enabled). |
1831 | | - The batch processor instance has two methods: \code{add} and \code{force}. |
1832 | | - The \code{add} method requires a function parameter that will be called when the \glslink{batch processing}{batch} is processed, and accepts an optional level parameter that defines at which level the given functon should be processed. |
1833 | | - The \code{force} method commence the processing of the \glslink{batch processing}{batch}, which can happen synchronously or asynchronously defined by an optional parameter. |
| 1839 | + |
1834 | 1840 | \todo[inline]{Finish me!} |
1835 | 1841 |
|
1836 | 1842 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
0 commit comments