aboutsummaryrefslogtreecommitdiffstats
path: root/include/classes/BigPipe
AgeCommit message (Collapse)AuthorFilesLines
2021-10-24Fix a bug in the Item constructor parameter listHEADmasterThomas Lange4-4/+4
The id parameter of the Pagelet and Resource constructor doesn't accept NULL values anymore (since 76cdd118d68bda3b7b29b192c7bf3d6e02bd6079). Therefore, allow NULL values by using the parameter type "?string" instead of "string" to allow either string values or NULL.
2021-10-24Rename several properties and method parametersThomas Lange5-14/+14
* Rename "ID" property of the Item class to "id" * Rename "customID" constructor parameter to "id" * Rename "resourceURL" property of the Resource class to "url" * Rename "resourceURL" constructor parameter to "url"
2021-10-24Add parameter and return types for all PHP methodsThomas Lange6-23/+23
2021-10-24Declare some BigPipe PHP library methods as voidThomas Lange2-14/+14
Class BigPipe\BigPipe: * addPhaseDoneJS Class BigPipe\Pagelet: * addHTML * addResource * addJSCode * addDependency * setTagName * setPlaceholderHTML
2021-10-24Split up BigPipe "enabled" method into two methodsThomas Lange2-10/+13
Split up the "enabled" method of the BigPipe class into two methods, one to check if the pipelining mode is currently enabled ("isEnabled") and another one to enable/disable the pipelining mode ("setEnabled"). This change prevents that a single method has two different jobs, which can be confusing for programmers who didn't wrote the code but only use them. Now there are two clearly named methods for exactly one job.
2021-10-24Reformat PHP code in "getStructure" methodThomas Lange1-1/+5
2021-10-24Rename "tagname" property and "setTagname" methodThomas Lange1-6/+6
Rename the "tagname" property and the "setTagname" method of the Pagelet class to the lowerCamelCase variant "tagName" because it are two words.
2021-10-24Rename misleading parameter "callback" to "code"Thomas Lange1-2/+2
Rename the second parameter for the "addPhaseDoneJS" method of the Item class from the misleading name "callback" to "code" because that method doesn't expect a real JS (or PHP) callback but rather simple JS code.
2021-10-24Fix constructor parameters for Resource classesThomas Lange3-3/+3
The first parameter for the constructor of the Resource classes should not be optional if the next parameters obviously are non-optional. The optional parameters (if any) must come after the required parameters.
2021-10-24Remove closing tags and ensure LF at end of filesThomas Lange6-6/+0
Remove the unnecessary PHP closing tags and ensure that *all* non-binary files ending with an LF character.
2018-01-28Replace function call "removeLineBreaksAndTabs" with "str_replace"Thomas Lange1-1/+1
This commit replaces the function call of "removeLineBreaksAndTabs" from "Pagelet::flush()" with the direct call of the "str_replace" function. Therefore, you don't need to include the external function "removeLineBreaksAndTabs" (which was located outside the BigPipe namespace) into your project anymore.
2018-01-28Remove superflous function calls from two methodsThomas Lange2-2/+2
This commit removes the superflous function calls "removeLineBreaksAndTabs" from the "Pagelet::getStructure()" and "Item::addPhaseDoneJS()" method. If it bothers you when some properties of the JSON-encoded pagelet object contain line breaks and tabs (visible as "\r", "\n" and "\t"), then you'll need to remove them before you pass the string of javascript code to the corresponding methods: * $Pagelet->addJSCode(removeLineBreaksAndTabs($javascript_code)); * $Pagelet->addPhaseDoneJS(0, removeLineBreaksAndTabs($javascript_code));
2018-01-26Remove static $count property and use spl_object_hash() insteadThomas Lange2-4/+2
2018-01-21Move BigPipe::singleResponse() to Pagelet::flush()Thomas Lange2-17/+19
2018-01-21Rename BigPipe::render() to BigPipe::completeResponse()Thomas Lange1-1/+1
2018-01-21Restructure the BigPipe::render() methodThomas Lange1-10/+14
2018-01-21Change the mechanism how BigPipe detects the last pageletThomas Lange1-6/+6
This commit is a preparation for a few further commits and changes the mechanism how the BigPipe javascript library detects the last flushed pagelet from server. Previously, there was a "IS_LAST:true" property in the JSON encoded pagelet object. However, this meant that when the pagelet was sent to the client, the server already needed to know at this point that this is the last pagelet. This can no longer be reliably determined in the future due to smaller restructuring. Instead of sending "IS_LAST:true" within the JSON encoded pagelet object of the last pagelet, the BigPipe::render() method on the server will display a <script> element which calls "BigPipe.onLastPageletArrived()" after all pagelets have been flushed. This call informs the javascript library that the last pagelet has been flushed and arrived at the client. This is required because the BigPipe javascript library otherwise doesn't know that the last pagelet has been arrived (the javascript library waits for all pagelets to be flushed and displayed until it begins to execute the external javascript resources of every pagelet).
2018-01-16Use seperate classes for debuggingThomas Lange1-53/+3
The debug mechanism has been changed. Instead of keeping the debug mechanism hardcoded within the core classes, it's now possible and recommended to use the seperate debugging classes which you can modify like you want. Those classes inherit their associated core classes and can add some debugging stuff. This has the advantage of having a clean core code without any debugging stuff. If the debug classes are not used then they shall not be included and their code will not be initialized.
2017-11-23The file permissions have been normalized.Thomas Lange3-0/+0
2017-10-21Code optimization: The method "getStructure" has been added to the abstract ↵Thomas Lange4-21/+37
Item class.
2017-10-07The shorthand methods "addCSS" and "addJS" have been removed. If you need ↵Thomas Lange1-14/+0
shorthand syntax, you can abstract the Pagelet class and use your own extended class which is more flexible and will keep the BigPipe main classes as small as possible.
2017-10-05The method "addDependency" no longer accepts a pagelet ID as a string. You ↵Thomas Lange1-6/+2
must now pass an existing Pagelet instance to the method!
2017-10-04The method "addPagelet" from the BigPipe main class was replaced by the new ↵Thomas Lange2-12/+25
implemented methods "enqueue" and "dequeue" for the new queueing mechanism. The "dequeue" method is currently unused but will be used in the future. The changes in this commit are partially preparations for further commits.
2017-10-04A new method called "getPriority" has been implemented, which returns the ↵Thomas Lange1-0/+9
priority of the corresponding Pagelet instance.
2017-08-16A new method called "setPlaceholderHTML" was implemented and can be used to ↵Thomas Lange1-1/+9
display custom HTML content immediately while the pagelet is still processing.
2017-08-06The "CSS" and "JS" resource representation classes has been renamed to ↵Thomas Lange1-4/+4
"Stylesheet" and "Javascript" to make it more consistent with the other class names (instead of using the abbreviations).
2017-08-06The "CSS" and "JS" resource representation classes has been renamed to ↵Thomas Lange2-4/+4
"Stylesheet" and "Javascript" to make it more consistent with the other class names (instead of using the abbreviations).
2017-03-08CSS class "hidden" was replaced by the semantic HTML5 attribute "hidden".Thomas Lange1-1/+1
2016-10-22The Pagelet representation class in PHP now has a separate method to add ↵Thomas Lange2-4/+14
dependencies (either with the instance of the dependency Pagelet or the unique ID as string as argument).
2016-07-10Comment updates: Separate email address for code stuff.Thomas Lange6-6/+6
2016-07-10Each resource has now an ID; Code improvements and comment blocks added.Thomas Lange6-107/+121
2016-06-25Update with new features and code improvements.Thomas Lange6-67/+243
+ New classes have been added: "BigPipe\Resource", "BigPipe\Resource\CSS", "BigPipe\Resource\JS". If you wan't to add a resource to a Pagelet, you can now built a new resource object with the "CSS" or "JS" class (the "Resource" class is abstract and the parent class of "CSS" and "JS") and can add PhaseDoneJS callbacks for this resources with "Resource::addPhaseDoneJS()" similar to "Pagelet::addPhaseDoneJS()". To add the resource to your pagelet: "$Pagelet->addResource($Resource)". Of course, you can still use the two SHORT methods "Pagelet::addCSS()" and "Pagelet::addJS()" which needs only one parameter with the resource URL. + Each resource has now PhaseDoneJS callbacks for 3 phases (Object initializied [INIT], Loading started [LOAD], Loading complete [DONE]). + Check your usage of the PhaseDoneJS callback constants of the Pagelet class: These constants have been renamed. + Debugging mode: Just set BigPipe::debugging(TRUE) and each pagelet and resource will be pass through a function which adds PhaseDoneJS callbacks with debug informations (Look now at the Javascript console and enjoy the beautiful colors which makes the debug informations better readable for your eyes. \(o_o)/). + Several code improvements on almost all files.
2016-06-23Pagelets executed immediately; Dependency feature; Several improvementsThomas Lange3-4/+13
+ All pagelets are now executed immediately on arrive. + A "Display Dependency" feature was added. If you give a pagelet an dependency, it will first be executed if all pagelets, who registered as dependency, are displayed. + If BigPipe.reset() is called, the function loops through each Resource and executes Resource.abortLoading(). This removes the <link> or <script> element from DOM and removes the onload callbacks. This is to prevent that an onload callback from a previous page are executed while the user has already changes the page asynchronously and a resource from the previous page wasn't already loaded.
2016-05-13Multiple updatesThomas Lange2-19/+33
2016-05-10Include JS resources before main JS codeThomas Lange1-4/+4
2016-05-10Comment updateThomas Lange1-1/+1
2016-05-10Comment updateThomas Lange1-1/+1
2016-05-10Double quotes converted to single quotesThomas Lange1-2/+2
2016-04-22Multiple updates with async demo.Thomas Lange2-41/+41
2016-03-26Custom pagelet ID'sThomas Lange2-4/+4
2015-12-26Multiple updates; new feature PhaseDoneJSThomas Lange3-31/+97
2015-07-25Namespaces addedThomas Lange2-0/+167