File tree Expand file tree Collapse file tree 5 files changed +53
-14
lines changed
Expand file tree Collapse file tree 5 files changed +53
-14
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " mmrl" ,
3- "version" : " 0.1.7 " ,
3+ "version" : " 0.1.8 " ,
44 "description" : " A library to make your life easier when working with MMRL's WebUI" ,
55 "source" : " src/index.ts" ,
66 "main" : " dist/index.cjs.js" ,
Original file line number Diff line number Diff line change @@ -266,19 +266,47 @@ export class MMRLInterface extends MMRLObjectAccessor<MMRLInterfaceImpl> {
266266 * it proceeds to request the advanced kernel SU API through the interface.
267267 */
268268 public requestAdvancedKernelSUAPI ( ) {
269- if ( this . isMMRL ) {
270- this . interface . requestAdvancedKernelSUAPI ( ) ;
269+ if ( ! this . isMMRL ) return ;
270+
271+ if ( ! this . mmrl ) {
272+ console . error (
273+ "BrickExeption: MMRL is not defined. Function not executed."
274+ ) ;
275+ return ;
271276 }
277+
278+ if ( this . mmrl . versionCode < 33045 ) {
279+ console . error (
280+ "BrickExeption: MMRL version is too old. Function not executed."
281+ ) ;
282+ return ;
283+ }
284+
285+ this . interface . requestAdvancedKernelSUAPI ( ) ;
272286 }
273287
274288 /**
275289 * Requests access to the file system API if the current instance is an MMRL.
276290 * If access to the file system is granted, it triggers the recompose method.
277291 */
278292 public requestFileSystemAPI ( ) {
279- if ( this . isMMRL ) {
280- this . interface . requestFileSystemAPI ( ) ;
293+ if ( ! this . isMMRL ) return ;
294+
295+ if ( ! this . mmrl ) {
296+ console . error (
297+ "BrickExeption: MMRL is not defined. Function not executed."
298+ ) ;
299+ return ;
281300 }
301+
302+ if ( this . mmrl . versionCode < 33045 ) {
303+ console . error (
304+ "BrickExeption: MMRL version is too old. Function not executed."
305+ ) ;
306+ return ;
307+ }
308+
309+ this . interface . requestFileSystemAPI ( ) ;
282310 }
283311}
284312
Original file line number Diff line number Diff line change 1- import { AccessorScope } from "../util/AccessorScope " ;
1+ import { ObjectScope } from "../types " ;
22
33/**
44 * The `MMRLObjectAccessor` class provides a base class for accessing MMRL objects.
@@ -20,15 +20,12 @@ export class MMRLObjectAccessor<I = any> {
2020 */
2121 public static static : MMRLObjectAccessor < any > ;
2222
23-
2423 /**
2524 * Creates an instance of `MMRLObjectAccessor`.
2625 *
27- * @param {AccessorScope. ObjectScope } scope - The scope to initialize the internal interface with.
26+ * @param {ObjectScope } scope - The scope to initialize the internal interface with.
2827 */
29- public constructor (
30- scope : AccessorScope . ObjectScope
31- ) {
28+ public constructor ( scope : ObjectScope ) {
3229 MMRLObjectAccessor . static = this ;
3330 this . _internal_interface = scope as I ;
3431 }
@@ -113,4 +110,20 @@ export class MMRLObjectAccessor<I = any> {
113110 return null ;
114111 }
115112 }
113+
114+ protected NativeMethod (
115+ target : any ,
116+ propertyName : string ,
117+ descriptor : PropertyDescriptor
118+ ) : void {
119+ const originalMethod = descriptor . value ;
120+
121+ const isMMRL = this . isMMRL ;
122+
123+ descriptor . value = function ( ...args : any [ ] ) {
124+ if ( ! isMMRL ) return ;
125+
126+ return originalMethod . apply ( this , args ) ;
127+ } ;
128+ }
116129}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 66 "declarationDir" : " ./dist" ,
77 "outDir" : " ./dist" ,
88 "strict" : true ,
9+ "experimentalDecorators" : true ,
910 "moduleResolution" : " node" ,
1011 "lib" : [" DOM" , " ESNext" ]
1112 },
You can’t perform that action at this time.
0 commit comments