@@ -246,13 +246,15 @@ public function isExternalUrl($path)
246246 * @param string $toRequire filename, or JS if inline manager
247247 * @param $options
248248 *
249+ * @param int $priority
250+ *
249251 * @return ResourceManager
250252 */
251- public function includeJs ($ toRequire , $ options = null )
253+ public function includeJs ($ toRequire , $ options = null , int $ priority = ResourceStore:: PRIORITY_DEFAULT )
252254 {
253255 try
254256 {
255- return $ this ->requireJs ($ toRequire , $ options );
257+ return $ this ->requireJs ($ toRequire , $ options, $ priority );
256258 }
257259 catch (Exception $ e )
258260 {
@@ -266,29 +268,33 @@ public function includeJs($toRequire, $options = null)
266268 * @param string $toRequire filename, or JS if inline manager
267269 * @param $options
268270 *
271+ * @param int $priority
272+ *
269273 * @return ResourceManager
270- * @throws \ Exception
274+ * @throws Exception
271275 */
272- public function requireJs ($ toRequire , $ options = null )
276+ public function requireJs ($ toRequire , $ options = null , int $ priority = ResourceStore:: PRIORITY_DEFAULT )
273277 {
274278 if ($ this ->_type == self ::MAP_INLINE )
275279 {
276280 return $ this ->_requireInlineJs ($ toRequire );
277281 }
278- Dispatch::instance ()->store ()->requireJs ($ this ->getResourceUri ($ toRequire ), $ options );
282+ Dispatch::instance ()->store ()->requireJs ($ this ->getResourceUri ($ toRequire ), $ options, $ priority );
279283 return $ this ;
280284 }
281285
282286 /**
283287 * Add a js script to the store
284288 *
285- * @param $javascript
289+ * @param $javascript
290+ *
291+ * @param int $priority
286292 *
287293 * @return ResourceManager
288294 */
289- protected function _requireInlineJs ($ javascript )
295+ protected function _requireInlineJs ($ javascript, int $ priority = ResourceStore:: PRIORITY_DEFAULT )
290296 {
291- Dispatch::instance ()->store ()->requireInlineJs ($ javascript );
297+ Dispatch::instance ()->store ()->requireInlineJs ($ javascript, $ priority );
292298 return $ this ;
293299 }
294300
@@ -298,16 +304,18 @@ protected function _requireInlineJs($javascript)
298304 * @param string $toRequire filename, or CSS if inline manager
299305 * @param $options
300306 *
307+ * @param int $priority
308+ *
301309 * @return ResourceManager
302- * @throws \ Exception
310+ * @throws Exception
303311 */
304- public function requireCss ($ toRequire , $ options = null )
312+ public function requireCss ($ toRequire , $ options = null , int $ priority = ResourceStore:: PRIORITY_DEFAULT )
305313 {
306314 if ($ this ->_type == self ::MAP_INLINE )
307315 {
308316 return $ this ->_requireInlineCss ($ toRequire );
309317 }
310- Dispatch::instance ()->store ()->requireCss ($ this ->getResourceUri ($ toRequire ), $ options );
318+ Dispatch::instance ()->store ()->requireCss ($ this ->getResourceUri ($ toRequire ), $ options, $ priority );
311319 return $ this ;
312320 }
313321
@@ -317,13 +325,15 @@ public function requireCss($toRequire, $options = null)
317325 * @param string $toRequire filename, or CSS if inline manager
318326 * @param $options
319327 *
328+ * @param int $priority
329+ *
320330 * @return ResourceManager
321331 */
322- public function includeCss ($ toRequire , $ options = null )
332+ public function includeCss ($ toRequire , $ options = null , int $ priority = ResourceStore:: PRIORITY_DEFAULT )
323333 {
324334 try
325335 {
326- return $ this ->requireCss ($ toRequire , $ options );
336+ return $ this ->requireCss ($ toRequire , $ options, $ priority );
327337 }
328338 catch (Exception $ e )
329339 {
@@ -334,13 +344,15 @@ public function includeCss($toRequire, $options = null)
334344 /**
335345 * Add css to the store
336346 *
337- * @param $stylesheet
347+ * @param $stylesheet
348+ *
349+ * @param int $priority
338350 *
339351 * @return ResourceManager
340352 */
341- protected function _requireInlineCss ($ stylesheet )
353+ protected function _requireInlineCss ($ stylesheet, int $ priority = ResourceStore:: PRIORITY_DEFAULT )
342354 {
343- Dispatch::instance ()->store ()->requireInlineCss ($ stylesheet );
355+ Dispatch::instance ()->store ()->requireInlineCss ($ stylesheet, $ priority );
344356 return $ this ;
345357 }
346358}
0 commit comments