This repository was archived by the owner on Mar 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ A minimalistic javascript api: The core is a little javascript that can extend i
55
66|   ;  ;  ; Version  ;  ;  ; | Info |
77| ---| ---|
8+ | 202112.01 | Init for bundled sApi_modules, bugfix for $s.require.object() |
89| 202012.01 | First public version of sApi, based on smdQS/smdApi from Schwäbisch Media Digital |
910| 202106.01 | Some little fixes |
1011
Original file line number Diff line number Diff line change 1818 _includeModulesPlaceHolder : { } ,
1919
2020 //to check which version of the api is running
21- version : 202106 .01,
21+ version : 202112 .01,
2222
2323 /**
2424 * extends smdApi with object
204204 _onApiReady ( $s , splittedApiName , apiName ) ;
205205 }
206206 } ;
207+
207208 /**
208- * Initializes all subobjects of $s.
209+ * Initializes all ready functions of $s' subobjects .
209210 */
210211 $s . ready ( function ( )
211212 {
217218 delete ( $s . _rF ) ;
218219 } ) ;
219220
221+ /**
222+ * Prepares all subobjects of $s that are bundled via sApi_modules
223+ */
224+ for ( let i in $s ) {
225+ if ( typeof $s [ i ] === "object" && i !== "_rF" ) {
226+ $s . _isapi ( $s , i , [ i ] ) ;
227+ }
228+ }
229+
220230 // default name is $s
221231 w [ pvn || "$s" ] = $s ;
222- } ( window , document ) ) ;
232+ } ( window , document ) ) ;
Original file line number Diff line number Diff line change @@ -142,6 +142,14 @@ $s.extend({
142142 */
143143 object : function ( objectName , callback , useCustomEventListener )
144144 {
145+ try {
146+ let re = new RegExp ( "^[a-zA-Z0-9_]+$" ) ;
147+ if ( re . exec ( objectName ) !== null && typeof eval ( objectName ) === "object" ) {
148+ callback ( ) ;
149+ return ;
150+ }
151+ } catch ( e ) { }
152+
145153 useCustomEventListener = useCustomEventListener || false ;
146154 if ( objectName in window ) {
147155 callback ( ) ;
@@ -158,4 +166,4 @@ $s.extend({
158166 }
159167 }
160168 }
161- } ) ;
169+ } ) ;
You can’t perform that action at this time.
0 commit comments