Socket
Socket
Sign inDemoInstall

@memberjunction/global

Package Overview
Dependencies
Maintainers
4
Versions
192
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@memberjunction/global - npm Package Compare versions

Comparing version 1.0.9 to 1.0.11

23

dist/ClassFactory.d.ts

@@ -14,9 +14,32 @@ /*******************************************************************************************************

}
/**
* ClassFactory is used to register and create instances of classes. It is a singleton class that can be used to register a sub-class for a given base class and key. Do NOT directly attempt to instantiate this class,
* instead use the static Instance property of the MJGlobal class to get the instance of the ClassFactory for your application.
*/
export declare class ClassFactory {
private _registrations;
/**
* Use this method or the @RegisterClass decorator to register a sub-class for a given base class.
* @param baseClass A reference to the base class you are registering a sub-class for
* @param subClass A reference to the sub-class you are registering
* @param key A key can be used to differentiate registrations for the same base class/sub-class combination. For example, in the case of BaseEntity and Entity object subclasses we'll have a LOT of entries and we want to get the highest priority registered sub-class for a specific key. In that case, the key is the entity name, but the key can be any value you want to use to differentiate registrations.
* @param priority Higher priority registrations will be used over lower priority registrations. If there are multiple registrations for a given base class/sub-class/key combination, the one with the highest priority will be used. If there are multiple registrations with the same priority, the last one registered will be used.
*/
Register(baseClass: any, subClass: any, key?: string, priority?: number): void;
/**
* Creates an instance of the class registered for the given base class and key. If no registration is found, will return an instance of the base class.
*/
CreateInstance<T>(baseClass: any, key?: string, ...params: any[]): T | null;
/**
* Returns all registrations for a given base class and key. If key is not provided, will return all registrations for the base class.
* @param baseClass
* @param key
* @returns
*/
GetAllRegistrations(baseClass: any, key?: string): ClassRegistration[];
/**
* Returns the registration with the highest priority for a given base class and key. If key is not provided, will return the registration with the highest priority for the base class.
*/
GetRegistration(baseClass: any, key?: string): ClassRegistration;
}
//# sourceMappingURL=ClassFactory.d.ts.map

@@ -14,2 +14,6 @@ "use strict";

exports.ClassRegistration = ClassRegistration;
/**
* ClassFactory is used to register and create instances of classes. It is a singleton class that can be used to register a sub-class for a given base class and key. Do NOT directly attempt to instantiate this class,
* instead use the static Instance property of the MJGlobal class to get the instance of the ClassFactory for your application.
*/
class ClassFactory {

@@ -19,2 +23,9 @@ constructor() {

}
/**
* Use this method or the @RegisterClass decorator to register a sub-class for a given base class.
* @param baseClass A reference to the base class you are registering a sub-class for
* @param subClass A reference to the sub-class you are registering
* @param key A key can be used to differentiate registrations for the same base class/sub-class combination. For example, in the case of BaseEntity and Entity object subclasses we'll have a LOT of entries and we want to get the highest priority registered sub-class for a specific key. In that case, the key is the entity name, but the key can be any value you want to use to differentiate registrations.
* @param priority Higher priority registrations will be used over lower priority registrations. If there are multiple registrations for a given base class/sub-class/key combination, the one with the highest priority will be used. If there are multiple registrations with the same priority, the last one registered will be used.
*/
Register(baseClass, subClass, key = null, priority = 0) {

@@ -38,2 +49,5 @@ if (baseClass && subClass) {

}
/**
* Creates an instance of the class registered for the given base class and key. If no registration is found, will return an instance of the base class.
*/
CreateInstance(baseClass, key = null, ...params) {

@@ -57,2 +71,8 @@ if (baseClass) {

}
/**
* Returns all registrations for a given base class and key. If key is not provided, will return all registrations for the base class.
* @param baseClass
* @param key
* @returns
*/
GetAllRegistrations(baseClass, key = undefined) {

@@ -68,2 +88,5 @@ if (baseClass) {

}
/**
* Returns the registration with the highest priority for a given base class and key. If key is not provided, will return the registration with the highest priority for the base class.
*/
GetRegistration(baseClass, key = undefined) {

@@ -70,0 +93,0 @@ let matches = this.GetAllRegistrations(baseClass, key);

11

dist/index.d.ts

@@ -10,3 +10,3 @@ import * as MJ from './interface';

/**
* Global class used for coordinating events and components across MemberJunction
* Global class used for coordinating events, creating class instances, and managing components across MemberJunction
*/

@@ -25,2 +25,5 @@ export declare class MJGlobal {

RegisterComponent(component: MJ.IMJComponent): void;
/**
* Resets the class to its initial state. Use very carefully and sparingly.
*/
Reset(): void;

@@ -38,3 +41,9 @@ /**

GetEventListener(withReplay?: boolean): Observable<MJ.MJEvent>;
/**
* Returns the global instance of the MJGlobal class. This is a singleton class, so there is only one instance of it in the application. Do not directly create new instances of MJGlobal, always use this method to get the instance.
*/
static get Instance(): MJGlobal;
/**
* Returns the instance of ClassFactory you should use in your application. Access this via the MJGlobal.Instance.ClassFactory property.
*/
get ClassFactory(): ClassFactory;

@@ -41,0 +50,0 @@ /**

@@ -29,3 +29,3 @@ "use strict";

/**
* Global class used for coordinating events and components across MemberJunction
* Global class used for coordinating events, creating class instances, and managing components across MemberJunction
*/

@@ -66,2 +66,5 @@ class MJGlobal {

}
/**
* Resets the class to its initial state. Use very carefully and sparingly.
*/
Reset() {

@@ -91,2 +94,5 @@ this._components = [];

}
/**
* Returns the global instance of the MJGlobal class. This is a singleton class, so there is only one instance of it in the application. Do not directly create new instances of MJGlobal, always use this method to get the instance.
*/
static get Instance() {

@@ -97,2 +103,5 @@ if (!MJGlobal._instance)

}
/**
* Returns the instance of ClassFactory you should use in your application. Access this via the MJGlobal.Instance.ClassFactory property.
*/
get ClassFactory() {

@@ -99,0 +108,0 @@ return this._classFactory;

3

dist/ObjectCache.d.ts

@@ -10,3 +10,4 @@ /**

/**
* ObjectCache can be used to cache objects as needed by any application in memory. These objects are NOT persisted to disk or any other storage medium, so they are only good for the lifetime of the application
* ObjectCache can be used to cache objects as needed by any application in memory. These objects are NOT persisted to disk or any other storage medium, so they are only good for the lifetime of the application.
* Do not attempt to directly instantiate this class, instead use the static Instance property of the MJGlobal class to get the instance of the ObjectCache for your application within that instance of MJGlobal.
*/

@@ -13,0 +14,0 @@ export declare class ObjectCache {

@@ -15,3 +15,4 @@ "use strict";

/**
* ObjectCache can be used to cache objects as needed by any application in memory. These objects are NOT persisted to disk or any other storage medium, so they are only good for the lifetime of the application
* ObjectCache can be used to cache objects as needed by any application in memory. These objects are NOT persisted to disk or any other storage medium, so they are only good for the lifetime of the application.
* Do not attempt to directly instantiate this class, instead use the static Instance property of the MJGlobal class to get the instance of the ObjectCache for your application within that instance of MJGlobal.
*/

@@ -18,0 +19,0 @@ class ObjectCache {

{
"name": "@memberjunction/global",
"version": "1.0.9",
"version": "1.0.11",
"description": "MemberJunction: Global Object - Needed for ALL other MJ components",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc