An `Observer` is an object that encapsulates information\n * about an interested object with a method that should\n * be called when a particular `Notification` is broadcast.
\n *\n * The notification method on the interested object should take\n * one parameter of type `Notification`
\n *\n * @param {function(Notification):void | null} [notify = null]\n * @param {Object | null} [context = null]\n */\n constructor(notify = null, context = null) {\n this._notifyMethod = notify;\n this._notifyContext = context;\n }\n\n /**\n * Notify the interested object.\n *\n * @param {Notification} notification\n */\n notifyObserver(notification) {\n this._notifyMethod.call(this._notifyContext, notification);\n }\n\n /**\n * Compare an object to the notification context.\n *\n * @param {Object} notifyContext\n * @returns {boolean}\n */\n compareNotifyContext(notifyContext) {\n return this._notifyContext === notifyContext;\n }\n\n /**\n * Get the notification method.\n *\n * @returns {function(Notification):void}\n */\n get notifyMethod() {\n return this._notifyMethod\n }\n\n /**\n * Set the notification method.\n *\n * The notification method should take one parameter of type `Notification`.
\n *\n * @param {function(Notification): void} notifyMethod - The function to be called when a notification is received.\n */\n set notifyMethod(notifyMethod) {\n this._notifyMethod = notifyMethod;\n }\n\n /**\n * Get the notifyContext\n *\n * @returns {Object}\n */\n get notifyContext() {\n return this._notifyContext;\n }\n\n /**\n * Set the notification context.\n *\n * @param {Object} notifyContext\n */\n set notifyContext(notifyContext) {\n this._notifyContext = notifyContext;\n }\n\n}\nexport { Observer }\n","/*\n * View.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Observer} from \"../patterns/observer/Observer.js\";\n\n/**\n * A Multiton `View` implementation.\n *\n * In PureMVC, the `View` class assumes these responsibilities:
\n *\n * \n * - Maintain a cache of `Mediator` instances.
\n * - Provide methods for registering, retrieving, and removing `Mediators`.
\n * - Notifying `Mediators` when they are registered or removed.
\n * - Managing the observer lists for each `Notification` in the application.
\n * - Providing a method for attaching `Observers` to a `Notification`'s observer list.
\n * - Providing a method for broadcasting a `Notification`.
\n * - Notifying the `Observers` of a given `Notification` when it broadcast.
\n *
\n *\n * @see Mediator Mediator\n * @see Observer Observer\n * @see Notification Notification\n *\n * @class View\n */\nclass View {\n\n /**\n * Constructor.\n *\n * This `View` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Multiton\n * Factory method `View.getInstance( multitonKey )`\n *\n * @constructor\n * @param {string} key\n *\n * @throws {Error} Error if instance for this Multiton key has already been constructed\n */\n constructor(key) {\n if (View.instanceMap.get(key) != null) throw new Error(View.MULTITON_MSG);\n /** @protected\n * @type {string} */\n this.multitonKey = key;\n View.instanceMap.set(this.multitonKey, this);\n /** @protected\n * @type {Map} */\n this.mediatorMap = new Map();\n /** @protected\n * @type {Map.>} */\n this.observerMap = new Map();\n this.initializeView();\n }\n\n /**\n * Initialize the Multiton View instance.
\n *\n * Called automatically by the constructor, this\n * is your opportunity to initialize the Multiton\n * instance in your subclass without overriding the\n * constructor.
\n */\n initializeView() {\n\n }\n\n /**\n * View Multiton factory method.\n *\n * @static\n * @param {string} key\n * @param {function(string):View} factory\n * @returns {View} the Multiton instance of `View`\n */\n static getInstance(key, factory) {\n if (View.instanceMap == null)\n /** @static\n * @type {Map} */\n View.instanceMap = new Map();\n if (View.instanceMap.get(key) == null) View.instanceMap.set(key, factory(key));\n return View.instanceMap.get(key);\n }\n\n /**\n * Register an `Observer` to be notified\n * of `Notifications` with a given name.
\n *\n * @param {string} notificationName the name of the `Notifications` to notify this `Observer` of\n * @param {Observer} observer the `Observer` to register\n */\n registerObserver(notificationName, observer) {\n if (this.observerMap.get(notificationName) != null) {\n let observers = this.observerMap.get(notificationName);\n observers.push(observer);\n } else {\n this.observerMap.set(notificationName, new Array(observer));\n }\n }\n\n /**\n * Notify the `Observers` for a particular `Notification`.
\n *\n * All previously attached `Observers` for this `Notification`'s\n * list are notified and are passed a reference to the `Notification` in\n * the order in which they were registered.
\n *\n * @param {Notification} notification the `Notification` to notify `Observers` of.\n */\n notifyObservers(notification) {\n if (this.observerMap.has(notification.name)) {\n // Copy observers from reference array to working array,\n // since the reference array may change during the notification loop\n let observers = this.observerMap.get(notification.name).slice();\n\n // Notify Observers from the working array\n for(let i = 0; i < observers.length; i++) {\n observers[i].notifyObserver(notification);\n }\n }\n }\n\n /**\n * Remove the observer for a given notifyContext from an observer list for a given Notification name.
\n *\n * @param {string} notificationName which observer list to remove from\n * @param {Object} notifyContext remove the observer with this object as its notifyContext\n */\n removeObserver(notificationName, notifyContext) {\n // the observer list for the notification under inspection\n let observers = this.observerMap.get(notificationName);\n\n // find the observer for the notifyContext\n for (let i = 0; i < observers.length; i++) {\n if (observers[i].compareNotifyContext(notifyContext) === true) {\n // there can only be one Observer for a given notifyContext\n // in any given Observer list, so remove it and break\n observers.splice(i, 1);\n break;\n }\n }\n\n // Also, when a Notification's Observer list length falls to\n // zero, delete the notification key from the observer map\n if (observers.length === 0) {\n this.observerMap.delete(notificationName);\n }\n }\n\n /**\n * Register a `Mediator` instance with the `View`.\n *\n * Registers the `Mediator` so that it can be retrieved by name,\n * and further interrogates the `Mediator` for its\n * `Notification` interests.
\n *\n * If the `Mediator` returns any `Notification`\n * names to be notified about, an `Observer` is created encapsulating\n * the `Mediator` instance's `handleNotification` method\n * and registering it as an `Observer` for all `Notifications` the\n * `Mediator` is interested in.
\n *\n * @param {Mediator} mediator a reference to the `Mediator` instance\n */\n registerMediator(mediator) {\n // do not allow re-registration (you must to removeMediator fist)\n if (this.mediatorMap.has(mediator.mediatorName) !== false) return;\n\n mediator.initializeNotifier(this.multitonKey);\n\n // Register the Mediator for retrieval by name\n this.mediatorMap.set(mediator.mediatorName, mediator);\n\n // Get Notification interests, if any.\n let interests = mediator.listNotificationInterests();\n\n // Register Mediator as an observer for each notification of interests\n if (interests.length > 0) {\n // Create Observer referencing this mediator's handleNotification method\n let observer = new Observer(mediator.handleNotification.bind(mediator), mediator); // check bind\n\n // Register Mediator as Observer for its list of Notification interests\n for (let i = 0; i < interests.length; i++) {\n this.registerObserver(interests[i], observer);\n }\n }\n\n // alert the mediator that it has been registered\n mediator.onRegister();\n }\n\n /**\n * Retrieve a `Mediator` from the `View`.\n *\n * @param {string} mediatorName the name of the `Mediator` instance to retrieve.\n * @returns {Mediator} the `Mediator` instance previously registered with the given `mediatorName`.\n */\n retrieveMediator(mediatorName) {\n return this.mediatorMap.get(mediatorName) || null;\n }\n\n /**\n * Remove a `Mediator` from the `View`.\n *\n * @param {string} mediatorName name of the `Mediator` instance to be removed.\n * @returns {Mediator} the `Mediator` that was removed from the `View`\n */\n removeMediator(mediatorName) {\n // Retrieve the named mediator\n let mediator = this.mediatorMap.get(mediatorName);\n\n if (mediator) {\n // for every notification this mediator is interested in...\n let interests = mediator.listNotificationInterests();\n for (let i = 0; i < interests.length; i++) {\n // remove the observer linking the mediator\n // to the notification interest\n this.removeObserver(interests[i], mediator);\n }\n\n // remove the mediator from the map\n this.mediatorMap.delete(mediatorName);\n\n // alert the mediator that it has been removed\n mediator.onRemove();\n }\n\n return mediator;\n }\n\n /**\n * Check if a Mediator is registered or not\n *\n * @param {string} mediatorName\n * @returns {boolean} whether a Mediator is registered with the given `mediatorName`.\n */\n hasMediator(mediatorName) {\n return this.mediatorMap.has(mediatorName);\n }\n\n /**\n * Remove a View instance\n *\n * @static\n * @param key multitonKey of View instance to remove\n */\n static removeView(key) {\n this.instanceMap.delete(key);\n }\n\n /**\n * Message Constants\n *\n * @static\n * @type {string}\n */\n static get MULTITON_MSG() { return \"View instance for this Multiton key already constructed!\" };\n\n}\nexport { View }\n","/*\n * Controller.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {View} from \"./View.js\"\nimport {Observer} from \"../patterns/observer/Observer.js\";\n\n/**\n * A Multiton `Controller` implementation.\n *\n * In PureMVC, the `Controller` class follows the\n * 'Command and Controller' strategy, and assumes these\n * responsibilities:
\n *\n * \n * - Remembering which `Command`s\n * are intended to handle which `Notifications`.
\n * - Registering itself as an `Observer` with\n * the `View` for each `Notification`\n * that it has a `Command` mapping for.
\n * - Creating a new instance of the proper `Command`\n * to handle a given `Notification` when notified by the `View`.
\n * - Calling the `Command`'s `execute`\n * method, passing in the `Notification`.
\n *
\n *\n * Your application must register `Commands` with the\n * Controller.
\n *\n * The simplest way is to subclass `Facade`,\n * and use its `initializeController` method to add your\n * registrations.
\n *\n * @see View View\n * @see Observer Observer\n * @see Notification Notification\n * @see SimpleCommand SimpleCommand\n * @see MacroCommand MacroCommand\n *\n * @class Controller\n */\nclass Controller {\n\n /**\n * Constructor.\n *\n * This `Controller` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Factory method,\n * passing the unique key for this instance\n * `Controller.getInstance( multitonKey )`
\n *\n * @constructor\n * @param {string} key\n *\n * @throws {Error} Error if instance for this Multiton key has already been constructed\n */\n constructor(key) {\n if (Controller.instanceMap[key] != null) throw new Error(Controller.MULTITON_MSG);\n /** @protected\n * @type {string} */\n this.multitonKey = key;\n Controller.instanceMap.set(this.multitonKey, this);\n /** @protected\n * @type {Map} */\n this.commandMap = new Map();\n this.initializeController();\n }\n\n /**\n * Initialize the Multiton `Controller` instance.\n *\n * Called automatically by the constructor.
\n *\n * Note that if you are using a subclass of `View`\n * in your application, you should also subclass `Controller`\n * and override the `initializeController` method in the\n * following way:
\n *\n * `\n *\t\t// ensure that the Controller is talking to my View implementation\n *\t\tinitializeController( )\n *\t\t{\n *\t\t\tthis.view = MyView.getInstance(this.multitonKey, (key) => new MyView(key));\n *\t\t}\n * `
\n *\n */\n initializeController() {\n /** @protected\n * @type {View} **/\n this.view = View.getInstance(this.multitonKey, (key) => new View(key));\n }\n\n /**\n * `Controller` Multiton Factory method.\n *\n * @static\n * @param {string} key\n * @param {function(string):Controller} factory\n * @returns {Controller} the Multiton instance of `Controller`\n */\n static getInstance(key, factory) {\n if (Controller.instanceMap == null)\n /** @static\n @type {Map} */\n Controller.instanceMap = new Map();\n if (Controller.instanceMap.get(key) == null) Controller.instanceMap.set(key, factory(key));\n return Controller.instanceMap.get(key);\n }\n\n /**\n * If a `Command` has previously been registered\n * to handle the given `Notification`, then it is executed.
\n *\n * @param {Notification} notification a `Notification`\n */\n executeCommand(notification) {\n let factory = this.commandMap.get(notification.name);\n if (factory == null) return;\n\n let commandInstance = factory();\n commandInstance.initializeNotifier(this.multitonKey);\n commandInstance.execute(notification);\n }\n\n /**\n * Register a particular `Command` class as the handler\n * for a particular `Notification`.
\n *\n * If an `Command` has already been registered to\n * handle `Notification`s with this name, it is no longer\n * used, the new `Command` is used instead.
\n *\n * The Observer for the new Command is only created if this the\n * first time a Command has been registered for this Notification name.
\n *\n * @param notificationName the name of the `Notification`\n * @param {function():SimpleCommand} factory\n */\n registerCommand(notificationName, factory) {\n if (this.commandMap.get(notificationName) == null) {\n this.view.registerObserver(notificationName, new Observer(this.executeCommand, this));\n }\n this.commandMap.set(notificationName, factory);\n }\n\n /**\n * Check if a Command is registered for a given Notification\n *\n * @param {string} notificationName\n * @return {boolean} whether a Command is currently registered for the given `notificationName`.\n */\n hasCommand(notificationName) {\n return this.commandMap.has(notificationName);\n }\n\n /**\n * Remove a previously registered `Command` to `Notification` mapping.\n *\n * @param {string} notificationName the name of the `Notification` to remove the `Command` mapping for\n */\n removeCommand(notificationName) {\n // if the Command is registered...\n if(this.hasCommand(notificationName)) {\n // remove the observer\n this.view.removeObserver(notificationName, this);\n\n // remove the command\n this.commandMap.delete(notificationName)\n }\n }\n\n /**\n * Remove a Controller instance\n *\n * @static\n * @param {string} key of Controller instance to remove\n */\n static removeController(key) {\n Controller.instanceMap.delete(key);\n }\n\n /**\n * Message Constants\n *\n * @static\n * @type {string}\n */\n static get MULTITON_MSG() { return \"Controller instance for this Multiton key already constructed!\" };\n}\nexport { Controller }\n","/*\n * Model.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\n/**\n * A Multiton `Model` implementation.\n *\n * In PureMVC, the `Model` class provides\n * access to model objects (Proxies) by named lookup.\n *\n *
The `Model` assumes these responsibilities:
\n *\n * \n * - Maintain a cache of `Proxy` instances.
\n * - Provide methods for registering, retrieving, and removing\n * `Proxy` instances.
\n *
\n *\n * Your application must register `Proxy` instances\n * with the `Model`. Typically, you use an\n * `Command` to create and register `Proxy`\n * instances once the `Facade` has initialized the Core\n * actors.
\n *\n * @see Proxy Proxy\n *\n * @class Model\n */\nclass Model {\n\n /**\n * Constructor.\n *\n * This `Model` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Multiton\n * Factory method `Model.getInstance( multitonKey )`\n *\n * @constructor\n * @param {string} key\n *\n * @throws {Error} Error if instance for this Multiton key instance has already been constructed\n */\n constructor(key) {\n if (Model.instanceMap.get(key) != null) throw new Error(Model.MULTITON_MSG);\n /** @protected\n * @type {string} */\n this.multitonKey = key;\n Model.instanceMap.set(this.multitonKey, this);\n /** @protected\n * @type {Map} */\n this.proxyMap = new Map();\n this.initializeModel();\n }\n\n /**\n * Initialize the `Model` instance.\n *\n * Called automatically by the constructor, this\n * is your opportunity to initialize the Multiton\n * instance in your subclass without overriding the\n * constructor.
\n *\n */\n initializeModel() {\n\n }\n\n /**\n * `Model` Multiton Factory method.\n *\n * @static\n * @param {string} key\n * @param {function(string):Model} factory\n * @returns {Model} the instance for this Multiton key\n */\n static getInstance(key, factory) {\n if (Model.instanceMap == null)\n /** @static\n @type {Map} */\n Model.instanceMap = new Map();\n if (Model.instanceMap.get(key) == null) Model.instanceMap.set(key, factory(key));\n return Model.instanceMap.get(key);\n }\n\n /**\n * Register a `Proxy` with the `Model`.\n *\n * @param {Proxy} proxy a `Proxy` to be held by the `Model`.\n */\n registerProxy(proxy) {\n proxy.initializeNotifier(this.multitonKey);\n this.proxyMap.set(proxy.proxyName, proxy);\n proxy.onRegister();\n }\n\n /**\n * Retrieve a `Proxy` from the `Model`.\n *\n * @param {string} proxyName\n * @returns {Proxy} the `Proxy` instance previously registered with the given `proxyName`.\n */\n retrieveProxy(proxyName) {\n return this.proxyMap.get(proxyName) || null;\n }\n\n /**\n * Check if a Proxy is registered\n *\n * @param {string} proxyName\n * @returns {boolean} whether a Proxy is currently registered with the given `proxyName`.\n */\n hasProxy(proxyName) {\n return this.proxyMap.has(proxyName);\n }\n\n /**\n * Remove a `Proxy` from the `Model`.\n *\n * @param {string} proxyName name of the `Proxy` instance to be removed.\n * @returns {Proxy} the `Proxy` that was removed from the `Model`\n */\n removeProxy(proxyName) {\n let proxy = this.proxyMap.get(proxyName);\n if (proxy != null) {\n this.proxyMap.delete(proxyName);\n proxy.onRemove();\n }\n return proxy;\n }\n\n /**\n * Remove a Model instance\n *\n * @static\n * @param key\n */\n static removeModel(key) {\n Model.instanceMap.delete(key);\n }\n\n /**\n * @static\n * @type {string}\n */\n static get MULTITON_MSG() { return \"Model instance for this Multiton key already constructed!\" };\n}\nexport { Model }\n","/*\n * Notification.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\n/**\n * A base `Notification` implementation.\n *\n * PureMVC does not rely upon underlying event models such\n * as the one provided with Flash, and ActionScript 3 does\n * not have an inherent event model.
\n *\n * The Observer Pattern as implemented within PureMVC exists\n * to support event-driven communication between the\n * application and the actors of the MVC triad.
\n *\n * Notifications are not meant to be a replacement for Events\n * in Flex/Flash/Apollo. Generally, `Mediator` implementors\n * place event listeners on their view components, which they\n * then handle in the usual way. This may lead to the broadcast of `Notification`s to\n * trigger `Command`s or to communicate with other `Mediators`. `Proxy` and `Command`\n * instances communicate with each other and `Mediator`s\n * by broadcasting `Notification`s.
\n *\n * A key difference between Flash `Event`s and PureMVC\n * `Notification`s is that `Event`s follow the\n * 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy\n * until some parent component handles the `Event`, while\n * PureMVC `Notification`s follow a 'Publish/Subscribe'\n * pattern. PureMVC classes need not be related to each other in a\n * parent/child relationship in order to communicate with one another\n * using `Notification`s.
\n *\n * @class Notification\n */\nclass Notification {\n\n /**\n * Constructor.\n *\n * @constructor\n * @param {string} name - The name of the notification.\n * @param {Object|null} [body=null] - The body of the notification, defaults to `null`.\n * @param {string} [type=\"\"] - The type of the notification, defaults to an empty string.\n */\n constructor(name, body = null, type = \"\") {\n this._name = name;\n this._body = body;\n this._type = type;\n }\n\n /**\n * Get the name of the `Notification` instance.\n *\n * @returns {string}\n */\n get name() {\n return this._name;\n }\n\n /**\n * Get the body of the `Notification` instance.\n *\n * @returns {Object | null}\n */\n get body() {\n return this._body;\n }\n\n /**\n * Set the body of the `Notification` instance.\n *\n * @param {Object|null} body\n */\n set body(body) {\n this._body = body;\n }\n\n /**\n * Get the type of the `Notification` instance.\n *\n * @returns {string}\n */\n get type() {\n return this._type;\n }\n\n /**\n * Set the type of the `Notification` instance.\n *\n * @param {string} type\n */\n set type(type) {\n this._type = type;\n }\n\n /**\n * Get the string representation of the `Notification` instance.\n *\n * @returns {string}\n */\n toString() {\n let str= \"Notification Name: \" + this.name;\n str+= \"\\nBody:\" + ((this.body == null ) ? \"null\" : this.body.toString());\n str+= \"\\nType:\" + ((this.type == null ) ? \"null\" : this.type);\n return str;\n }\n\n}\nexport { Notification }\n","/*\n * Facade.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Controller} from \"../../core/Controller.js\";\nimport {Model} from \"../../core/Model.js\";\nimport {View} from \"../../core/View.js\";\nimport {Notification} from \"../observer/Notification.js\";\n\n/**\n * A base Multiton `Facade` implementation.\n *\n * @see Model Model\n * @see View View\n * @see Controller Controller\n *\n * @class Facade\n */\nclass Facade {\n\n /**\n * Constructor.\n *\n * This `Facade` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Factory method,\n * passing the unique key for this instance\n * `Facade.getInstance( multitonKey )`
\n *\n * @constructor\n * @param {string} key\n *\n * @throws {Error} Error if instance for this Multiton key has already been constructed\n */\n constructor(key) {\n if (Facade.instanceMap[key] != null) throw new Error(Facade.MULTITON_MSG);\n this.initializeNotifier(key);\n Facade.instanceMap.set(this.multitonKey, this);\n this.initializeFacade();\n }\n\n /**\n * Initialize the Multiton `Facade` instance.\n *\n * Called automatically by the constructor. Override in your\n * subclass to do any subclass specific initializations. Be\n * sure to call `super.initializeFacade()`, though.
\n */\n initializeFacade() {\n this.initializeModel();\n this.initializeController();\n this.initializeView();\n }\n\n /**\n * Facade Multiton Factory method\n *\n * @static\n * @param {string} key\n * @param {function(string):Facade} factory\n * @returns {Facade} the Multiton instance of the Facade\n */\n static getInstance(key, factory) {\n if (Facade.instanceMap == null)\n /** @static\n * @type {Map} */\n Facade.instanceMap = new Map();\n if (Facade.instanceMap.get(key) == null) Facade.instanceMap.set(key, factory(key));\n return Facade.instanceMap.get(key);\n }\n\n /**\n * Initialize the `Model`.\n *\n * Called by the `initializeFacade` method.\n * Override this method in your subclass of `Facade`\n * if one or both of the following are true:
\n *\n * \n * - You wish to initialize a different `Model`.
\n * - You have `Proxy`s to register with the Model that do not\n * retrieve a reference to the Facade at construction time.`
\n *
\n *\n * If you don't want to initialize a different `Model`,\n * call `super.initializeModel()` at the beginning of your\n * method, then register `Proxy`s.\n *\n * Note: This method is rarely overridden; in practice you are more\n * likely to use a `Command` to create and register `Proxy`s\n * with the `Model`, since `Proxy`s with mutable data will likely\n * need to send `Notification`s and thus will likely want to fetch a reference to\n * the `Facade` during their construction.
\n */\n initializeModel() {\n if (this.model != null) return;\n this.model = Model.getInstance(this.multitonKey, key => new Model(key));\n }\n\n /**\n * Initialize the `Controller`.\n *\n * Called by the `initializeFacade` method.\n * Override this method in your subclass of `Facade`\n * if one or both of the following are true:
\n *\n * \n * - You wish to initialize a different `Controller`.
\n * - You have `Commands` to register with the `Controller` at startup.`.
\n *
\n *\n * If you don't want to initialize a different `Controller`,\n * call `super.initializeController()` at the beginning of your\n * method, then register `Command`s.
\n */\n initializeController() {\n if (this.controller != null) return;\n this.controller = Controller.getInstance(this.multitonKey, key => new Controller(key));\n }\n\n /**\n * Initialize the `View`.\n *\n * Called by the `initializeFacade` method.\n * Override this method in your subclass of `Facade`\n * if one or both of the following are true:
\n *\n * \n * - You wish to initialize a different `View`.
\n * - You have `Observers` to register with the `View`
\n *
\n *\n * If you don't want to initialize a different `View`,\n * call `super.initializeView()` at the beginning of your\n * method, then register `Mediator` instances.
\n *\n * Note: This method is rarely overridden; in practice you are more\n * likely to use a `Command` to create and register `Mediator`s\n * with the `View`, since `Mediator` instances will need to send\n * `Notification`s and thus will likely want to fetch a reference\n * to the `Facade` during their construction.
\n */\n initializeView() {\n if (this.view != null) return;\n this.view = View.getInstance(this.multitonKey, key => new View(key));\n }\n\n /**\n * Register a `Command` with the `Controller` by Notification name.\n *\n * @param {string} notificationName the name of the `Notification` to associate the `Command` with\n * @param {function():SimpleCommand} factory a reference to the factory of the `Command`\n */\n registerCommand(notificationName, factory) {\n this.controller.registerCommand(notificationName, factory);\n }\n\n /**\n * Check if a Command is registered for a given Notification\n *\n * @param {string} notificationName\n * @returns {boolean} whether a Command is currently registered for the given `notificationName`.\n */\n hasCommand(notificationName) {\n return this.controller.hasCommand(notificationName);\n }\n\n /**\n * Remove a previously registered `Command` to `Notification` mapping from the Controller.\n *\n * @param {string} notificationName the name of the `Notification` to remove the `Command` mapping for\n */\n removeCommand(notificationName) {\n this.controller.removeCommand(notificationName);\n }\n\n /**\n * Register a `Proxy` with the `Model` by name.\n *\n * @param {Proxy} proxy the `Proxy` instance to be registered with the `Model`.\n */\n registerProxy(proxy) {\n this.model.registerProxy(proxy);\n }\n\n /**\n * Remove a `Proxy` from the `Model` by name.\n *\n * @param {string} proxyName the `Proxy` to remove from the `Model`.\n * @returns {Proxy} the `Proxy` that was removed from the `Model`\n */\n removeProxy(proxyName) {\n return this.model.removeProxy(proxyName);\n }\n\n /**\n * Check if a `Proxy` is registered\n *\n * @param {string} proxyName\n * @returns {boolean} whether a Proxy is currently registered with the given `proxyName`.\n */\n hasProxy(proxyName) {\n return this.model.hasProxy(proxyName);\n }\n\n /**\n * Retrieve a `Proxy` from the `Model` by name.\n *\n * @param {string} proxyName the name of the proxy to be retrieved.\n * @returns {Proxy} the `Proxy` instance previously registered with the given `proxyName`.\n */\n retrieveProxy(proxyName) {\n return this.model.retrieveProxy(proxyName);\n }\n\n /**\n * Register a `Mediator` with the `View`.\n *\n * @param {Mediator} mediator a reference to the `Mediator`\n */\n registerMediator(mediator) {\n this.view.registerMediator(mediator);\n }\n\n /**\n * Remove a `Mediator` from the `View`.\n *\n * @param {string} mediatorName name of the `Mediator` to be removed.\n * @returns {Mediator} the `Mediator` that was removed from the `View`\n */\n removeMediator(mediatorName) {\n return this.view.removeMediator(mediatorName);\n }\n\n /**\n * Check if a `Mediator` is registered or not\n *\n * @param {string} mediatorName\n * @returns {boolean} whether a Mediator is registered with the given `mediatorName`.\n */\n hasMediator(mediatorName) {\n return this.view.hasMediator(mediatorName);\n }\n\n /**\n * Retrieve a `Mediator` from the `View`.\n *\n * @param {string} mediatorName\n * @returns {Mediator} the `Mediator` previously registered with the given `mediatorName`.\n */\n retrieveMediator(mediatorName) {\n return this.view.retrieveMediator(mediatorName);\n }\n\n /**\n * Create and send an `Notification`.\n *\n * Keeps us from having to construct new notification\n * instances in our implementation code.
\n *\n * @param {string} notificationName the name of the notification to send\n * @param {Object} [body] body the body of the notification (optional)\n * @param {string} [type] type the type of the notification (optional)\n */\n sendNotification(notificationName, body = null, type = \"\") {\n this.notifyObservers(new Notification(notificationName, body, type));\n }\n\n /**\n * Notify `Observer`s.\n *\n * This method is left public mostly for backward\n * compatibility, and to allow you to send custom\n * notification classes using the facade.
\n *\n * Usually you should just call `sendNotification`\n * and pass the parameters, never having to\n * construct the notification yourself.
\n *\n * @param {Notification} notification the `Notification` to have the `View` notify `Observers` of.\n */\n notifyObservers(notification) {\n this.view.notifyObservers(notification);\n }\n\n /**\n * Set the Multiton key for this facade instance.\n *\n * Not called directly, but instead from the\n * constructor when getInstance is invoked.\n * It is necessary to be public in order to\n * implement Notifier.
\n */\n initializeNotifier(key) {\n this.multitonKey = key;\n }\n\n /**\n * Check if a Core is registered or not\n *\n * @static\n * @param {string} key the multiton key for the Core in question\n * @returns {boolean} whether a Core is registered with the given `key`.\n */\n static hasCore(key) {\n return this.instanceMap.has(key);\n }\n\n /**\n * Remove a Core.\n *\n * Remove the Model, View, Controller and Facade\n * instances for the given key.
\n *\n * @static\n * @param {string} key multitonKey of the Core to remove\n */\n static removeCore(key) {\n if (Facade.instanceMap.get(key) == null) return;\n Model.removeModel(key);\n View.removeView(key);\n Controller.removeController(key);\n this.instanceMap.delete(key);\n }\n\n /**\n * Message Constants\n *\n * @static\n * @returns {string}\n */\n static get MULTITON_MSG() {return \"Facade instance for this Multiton key already constructed!\"};\n}\nexport { Facade }\n","/*\n * Notifier.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Facade} from \"../facade/Facade.js\";\n\n/**\n * A Base `Notifier` implementation.\n *\n * `MacroCommand, Command, Mediator` and `Proxy`\n * all have a need to send `Notifications`.
\n *\n *
The `Notifier` interface provides a common method called\n * `sendNotification` that relieves implementation code of\n * the necessity to actually construct `Notifications`.
\n *\n * The `Notifier` class, which all the above-mentioned classes\n * extend, provides an initialized reference to the `Facade`\n * Multiton, which is required for the convenience method\n * for sending `Notifications`, but also eases implementation as these\n * classes have frequent `Facade` interactions and usually require\n * access to the facade anyway.
\n *\n * NOTE: In the MultiCore version of the framework, there is one caveat to\n * notifiers, they cannot send notifications or reach the facade until they\n * have a valid multitonKey.
\n *\n * The multitonKey is set:\n * * on a Command when it is executed by the Controller\n * * on a Mediator is registered with the View\n * * on a Proxy is registered with the Model.\n *\n * @see Proxy Proxy\n * @see Facade Facade\n * @see Mediator Mediator\n * @see MacroCommand MacroCommand\n * @see SimpleCommand SimpleCommand\n *\n * @class Notifier\n */\nclass Notifier {\n\n constructor() {}\n\n /**\n * Create and send an `Notification`.\n *\n * Keeps us from having to construct new Notification\n * instances in our implementation code.
\n *\n * @param {string} notificationName\n * @param {Object} [body] body\n * @param {string} [type] type\n */\n sendNotification (notificationName, body = null, type = \"\") {\n if (this.facade != null) {\n this.facade.sendNotification(notificationName, body, type);\n }\n }\n\n /**\n * Initialize this Notifier instance.\n *\n * This is how a Notifier gets its multitonKey.\n * Calls to sendNotification or to access the\n * facade will fail until after this method\n * has been called.
\n *\n * Mediators, Commands or Proxies may override\n * this method in order to send notifications\n * or access the Multiton Facade instance as\n * soon as possible. They CANNOT access the facade\n * in their constructors, since this method will not\n * yet have been called.
\n *\n * @param {string} key the multitonKey for this Notifier to use\n */\n initializeNotifier(key) {\n this.multitonKey = key;\n }\n\n /**\n * Return the Multiton Facade instance\n *\n * @typedef {Facade} Facade\n *\n * @throws {Error}\n */\n get facade() {\n if (this.multitonKey == null) throw new Error(Notifier.MULTITON_MSG);\n return Facade.getInstance(this.multitonKey, key => new Facade(key));\n }\n\n /**\n * Message Constants\n *\n * @static\n * @returns {string}\n */\n static get MULTITON_MSG() { return \"multitonKey for this Notifier not yet initialized!\" }\n}\nexport { Notifier }\n","/*\n * SimpleCommand.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Notifier} from \"../observer/Notifier.js\";\n\n/**\n * A base `Command` implementation.\n *\n * Your subclass should override the `execute`\n * method where your business logic will handle the `Notification`.
\n *\n * @see Controller Controller\n * @see Notification Notification\n * @see MacroCommand MacroCommand\n *\n * @class SimpleCommand\n */\nclass SimpleCommand extends Notifier {\n\n constructor() {\n super();\n }\n\n /**\n * Fulfill the use-case initiated by the given `Notification`.\n *\n * In the Command Pattern, an application use-case typically\n * begins with some user action, which results in a `Notification` being broadcast, which\n * is handled by business logic in the `execute` method of an\n * `Command`.
\n *\n * @param {Notification} notification\n */\n execute(notification) {\n\n }\n\n}\nexport { SimpleCommand }\n","/*\n * Mediator.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Notifier} from \"../observer/Notifier.js\";\n\n/**\n * A base `Mediator` implementation.\n *\n * @see View View\n *\n * @class Mediator\n */\nclass Mediator extends Notifier {\n\n /**\n * Constructor.\n *\n * @constructor\n * @param {string | null} [mediatorName=null]\n * @param {Object | null} [viewComponent=null]\n */\n constructor(mediatorName = null, viewComponent = null) {\n super();\n this._mediatorName = mediatorName || Mediator.NAME;\n this._viewComponent = viewComponent;\n }\n\n /**\n * Called by the View when the Mediator is registered\n */\n onRegister() {\n\n }\n\n /**\n * Called by the View when the Mediator is removed\n */\n onRemove() {\n\n }\n\n /**\n * List the `Notification` names this\n * `Mediator` is interested in being notified of.\n *\n * @returns {string[]}\n */\n listNotificationInterests() {\n return [];\n }\n\n /**\n * Handle `Notification`s.\n *\n * \n * Typically this will be handled in a switch statement,\n * with one 'case' entry per `Notification`\n * the `Mediator` is interested in.\n *\n * @param {Notification} notification\n */\n handleNotification(notification) {\n\n }\n\n /**\n * the mediator name\n *\n * @returns {string}\n */\n get mediatorName() {\n return this._mediatorName;\n }\n\n /**\n * Get the `Mediator`'s view component.\n *\n *
\n * Additionally, an implicit getter will usually\n * be defined in the subclass that casts the view\n * object to a type, like this:
\n *\n * @returns {Object | null}\n */\n get viewComponent() {\n return this._viewComponent;\n }\n\n /**\n * Set the `Mediator`'s view component.\n *\n * @param {Object} viewComponent\n */\n set viewComponent(viewComponent) {\n this._viewComponent = viewComponent;\n }\n\n /**\n * The name of the `Mediator`.\n *\n * Typically, a `Mediator` will be written to serve\n * one specific control or group controls and so,\n * will not have a need to be dynamically named.
\n *\n * @static\n * @returns {string}\n */\n static get NAME() { return \"Mediator\" }\n}\nexport { Mediator }\n","/*\n * Proxy.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Notifier} from \"../observer/Notifier.js\";\n\n/**\n * A base `Proxy` implementation.\n *\n * In PureMVC, `Proxy` classes are used to manage parts of the\n * application's data model.
\n *\n * A `Proxy` might simply manage a reference to a local data object,\n * in which case interacting with it might involve setting and\n * getting of its data in synchronous fashion.
\n *\n * `Proxy` classes are also used to encapsulate the application's\n * interaction with remote services to save or retrieve data, in which case,\n * we adopt an asynchronous idiom; setting data (or calling a method) on the\n * `Proxy` and listening for a `Notification` to be sent\n * when the `Proxy` has retrieved the data from the service.
\n *\n * @see Model Model\n *\n * @class Proxy\n */\nclass Proxy extends Notifier {\n /**\n * Constructor\n *\n * @constructor\n * @param {string | null} [proxyName=null]\n * @param {Object | null} [data=null]\n */\n constructor(proxyName = null, data = null) {\n super();\n /** @protected\n * @type {string} */\n this._proxyName = proxyName || Proxy.NAME;\n /** @protected\n * @type {Object | null} */\n this._data = data;\n }\n\n /**\n * Called by the Model when the Proxy is registered\n */\n onRegister() {}\n\n /**\n * Called by the Model when the Proxy is removed\n */\n onRemove() {}\n\n /**\n * Get the proxy name\n *\n * @returns {string}\n */\n get proxyName() {\n return this._proxyName;\n }\n\n /**\n * Get the data object\n *\n * @returns {Object | null}\n */\n get data () {\n return this._data;\n }\n\n /**\n * Set the data object\n *\n * @param {Object} data\n */\n set data(data) {\n this._data = data;\n }\n\n /**\n *\n * @static\n * @returns {string}\n */\n static get NAME() { return \"Proxy\" }\n}\nexport { Proxy }\n","/*\n * MacroCommand.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {SimpleCommand} from \"./SimpleCommand.js\";\n\n/**\n * A base `Command` implementation that executes other `Command`s.\n *\n * A `MacroCommand` maintains a list of\n * `Command` Class references called SubCommands.
\n *\n * When `execute` is called, the `MacroCommand`\n * instantiates and calls `execute` on each of its SubCommands turn.\n * Each SubCommand will be passed a reference to the original\n * `Notification` that was passed to the `MacroCommand`'s\n * `execute` method.
\n *\n * Unlike `SimpleCommand`, your subclass\n * should not override `execute`, but instead, should\n * override the `initializeMacroCommand` method,\n * calling `addSubCommand` once for each SubCommand\n * to be executed.
\n *\n * @see Controller Controller\n * @see Notification Notification\n * @see SimpleCommand SimpleCommand\n *\n * @class MacroCommand\n */\nclass MacroCommand extends SimpleCommand {\n\n /**\n * Constructor.\n *\n * You should not need to define a constructor,\n * instead, override the `initializeMacroCommand`\n * method.
\n *\n * If your subclass does define a constructor, be\n * sure to call `super()`.
\n *\n * @constructor\n */\n constructor() {\n super();\n /** @protected\n * @type {Array.} */\n this.subCommands = [];\n this.initializeMacroCommand();\n }\n\n /**\n * Initialize the `MacroCommand`.\n *\n * In your subclass, override this method to\n * initialize the `MacroCommand`'s SubCommand\n * list with `Command` class references like\n * this:
\n *\n * `\n *\t\t// Initialize MyMacroCommand\n *\t\tinitializeMacroCommand() {\n *\t\t\tthis.addSubCommand(() => new app.FirstCommand());\n *\t\t\tthis.addSubCommand(() => new app.SecondCommand());\n *\t\t\tthis.addSubCommand(() => new app.ThirdCommand());\n *\t\t}\n * `
\n *\n * Note that SubCommands may be any `Command` implementor,\n * `MacroCommand`s or `SimpleCommands` are both acceptable.\n */\n initializeMacroCommand() {\n\n }\n\n /**\n * Add a SubCommand.\n *\n *
The SubCommands will be called in First In/First Out (FIFO)\n * order.
\n *\n * @param {function():SimpleCommand} factory\n */\n addSubCommand(factory) {\n this.subCommands.push(factory);\n }\n\n /**\n * Execute this `MacroCommand`'s SubCommands.\n *\n * The SubCommands will be called in First In/First Out (FIFO)\n * order.
\n *\n * @param {Notification} notification\n */\n execute(notification) {\n while(this.subCommands.length > 0) {\n let factory = this.subCommands.shift();\n let commandInstance = factory();\n commandInstance.initializeNotifier(this.multitonKey);\n commandInstance.execute(notification);\n }\n }\n\n}\nexport { MacroCommand }\n"],"names":["Observer","constructor","notify","context","this","_notifyMethod","_notifyContext","notifyObserver","notification","call","compareNotifyContext","notifyContext","notifyMethod","View","key","instanceMap","get","Error","MULTITON_MSG","multitonKey","set","mediatorMap","Map","observerMap","initializeView","getInstance","factory","registerObserver","notificationName","observer","push","Array","notifyObservers","has","name","observers","slice","i","length","removeObserver","splice","delete","registerMediator","mediator","mediatorName","initializeNotifier","interests","listNotificationInterests","handleNotification","bind","onRegister","retrieveMediator","removeMediator","onRemove","hasMediator","removeView","Controller","commandMap","initializeController","view","executeCommand","commandInstance","execute","registerCommand","hasCommand","removeCommand","removeController","Model","proxyMap","initializeModel","registerProxy","proxy","proxyName","retrieveProxy","hasProxy","removeProxy","removeModel","Notification","body","type","_name","_body","_type","toString","str","Facade","initializeFacade","model","controller","sendNotification","hasCore","removeCore","Notifier","facade","SimpleCommand","super","Mediator","viewComponent","_mediatorName","NAME","_viewComponent","Proxy","data","_proxyName","_data","subCommands","initializeMacroCommand","addSubCommand","shift"],"mappings":"aA0BA,MAAMA,EAWF,WAAAC,CAAYC,EAAS,KAAMC,EAAU,MACjCC,KAAKC,cAAgBH,EACrBE,KAAKE,eAAiBH,CACzB,CAOD,cAAAI,CAAeC,GACXJ,KAAKC,cAAcI,KAAKL,KAAKE,eAAgBE,EAChD,CAQD,oBAAAE,CAAqBC,GACjB,OAAOP,KAAKE,iBAAmBK,CAClC,CAOD,gBAAIC,GACA,OAAOR,KAAKC,aACf,CASD,gBAAIO,CAAaA,GACbR,KAAKC,cAAgBO,CACxB,CAOD,iBAAID,GACA,OAAOP,KAAKE,cACf,CAOD,iBAAIK,CAAcA,GACdP,KAAKE,eAAiBK,CACzB,EClEL,MAAME,EAeF,WAAAZ,CAAYa,GACR,GAAiC,MAA7BD,EAAKE,YAAYC,IAAIF,GAAc,MAAM,IAAIG,MAAMJ,EAAKK,cAG5Dd,KAAKe,YAAcL,EACnBD,EAAKE,YAAYK,IAAIhB,KAAKe,YAAaf,MAGvCA,KAAKiB,YAAc,IAAIC,IAGvBlB,KAAKmB,YAAc,IAAID,IACvBlB,KAAKoB,gBACR,CAUD,cAAAA,GAEC,CAUD,kBAAOC,CAAYX,EAAKY,GAMpB,OALwB,MAApBb,EAAKE,cAGLF,EAAKE,YAAc,IAAIO,KACM,MAA7BT,EAAKE,YAAYC,IAAIF,IAAcD,EAAKE,YAAYK,IAAIN,EAAKY,EAAQZ,IAClED,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F,KAAKgG,eAAiBH,CACzB,CAYD,eAAWE,GAAS,MAAO,UAAY,EClF3C,MAAME,UAAcT,EAQhB,WAAA3F,CAAYuE,EAAY,KAAM8B,EAAO,MACjCP,QAGA3F,KAAKmG,WAAa/B,GAAa6B,EAAMF,KAGrC/F,KAAKoG,MAAQF,CAChB,CAKD,UAAApD,GAAe,CAKf,QAAAG,GAAa,CAOb,aAAImB,GACA,OAAOpE,KAAKmG,UACf,CAOD,QAAID,GACA,OAAOlG,KAAKoG,KACf,CAOD,QAAIF,CAAKA,GACLlG,KAAKoG,MAAQF,CAChB,CAOD,eAAWH,GAAS,MAAO,OAAS,6DCxDxC,cAA2BL,EAcvB,WAAA7F,GACI8F,QAGA3F,KAAKqG,YAAc,GACnBrG,KAAKsG,wBACR,CAsBD,sBAAAA,GAEC,CAUD,aAAAC,CAAcjF,GACVtB,KAAKqG,YAAY3E,KAAKJ,EACzB,CAUD,OAAAoC,CAAQtD,GACJ,KAAMJ,KAAKqG,YAAYnE,OAAS,GAAG,CAC/B,IACIuB,EADUzD,KAAKqG,YAAYG,OACTlF,GACtBmC,EAAgBhB,mBAAmBzC,KAAKe,aACxC0C,EAAgBC,QAAQtD,EAC3B,CACJ"}
\ No newline at end of file
diff --git a/bin/cjs/puremvc.min.cjs b/bin/cjs/puremvc.min.cjs
deleted file mode 100644
index ec5ea30..0000000
--- a/bin/cjs/puremvc.min.cjs
+++ /dev/null
@@ -1,2 +0,0 @@
-"use strict";class t{constructor(t,e){this._notifyMethod=t,this._notifyContext=e}notifyObserver(t){this._notifyMethod.call(this._notifyContext,t)}compareNotifyContext(t){return this._notifyContext===t}get notifyMethod(){return this._notifyMethod}set notifyMethod(t){this._notifyMethod=t}get notifyContext(){return this._notifyContext}set notifyContext(t){this._notifyContext=t}}class e{constructor(t){if(null!=e.instanceMap.get(t))throw new Error(e.MULTITON_MSG);this.multitonKey=t,e.instanceMap.set(this.multitonKey,this),this.mediatorMap=new Map,this.observerMap=new Map,this.initializeView()}initializeView(){}static getInstance(t,i){return null==e.instanceMap&&(e.instanceMap=new Map),null==e.instanceMap.get(t)&&e.instanceMap.set(t,i(t)),e.instanceMap.get(t)}registerObserver(t,e){if(null!=this.observerMap.get(t)){this.observerMap.get(t).push(e)}else this.observerMap.set(t,new Array(e))}notifyObservers(t){if(this.observerMap.has(t.name)){let e=this.observerMap.get(t.name).slice();for(let i=0;i0){let n=new t(e.handleNotification.bind(e),e);for(let t=0;tnew e(t)))}static getInstance(t,e){return null==i.instanceMap&&(i.instanceMap=new Map),null==i.instanceMap.get(t)&&i.instanceMap.set(t,e(t)),i.instanceMap.get(t)}executeCommand(t){let e=this.commandMap.get(t.name);if(null==e)return;let i=e();i.initializeNotifier(this.multitonKey),i.execute(t)}registerCommand(e,i){null==this.commandMap.get(e)&&this.view.registerObserver(e,new t(this.executeCommand,this)),this.commandMap.set(e,i)}hasCommand(t){return this.commandMap.has(t)}removeCommand(t){this.hasCommand(t)&&(this.view.removeObserver(t,this),this.commandMap.delete(t))}static removeController(t){i.instanceMap.delete(t)}static get MULTITON_MSG(){return"Controller instance for this Multiton key already constructed!"}}class n{constructor(t){if(null!=n.instanceMap.get(t))throw new Error(n.MULTITON_MSG);this.multitonKey=t,n.instanceMap.set(this.multitonKey,this),this.proxyMap=new Map,this.initializeModel()}initializeModel(){}static getInstance(t,e){return null==n.instanceMap&&(n.instanceMap=new Map),null==n.instanceMap.get(t)&&n.instanceMap.set(t,e(t)),n.instanceMap.get(t)}registerProxy(t){t.initializeNotifier(this.multitonKey),this.proxyMap.set(t.proxyName,t),t.onRegister()}retrieveProxy(t){return this.proxyMap.get(t)||null}hasProxy(t){return this.proxyMap.has(t)}removeProxy(t){let e=this.proxyMap.get(t);return null!=e&&(this.proxyMap.delete(t),e.onRemove()),e}static removeModel(t){n.instanceMap.delete(t)}static get MULTITON_MSG(){return"Model instance for this Multiton key already constructed!"}}class r{constructor(t,e=null,i=""){this._name=t,this._body=e,this._type=i}get name(){return this._name}get body(){return this._body}set body(t){this._body=t}get type(){return this._type}set type(t){this._type=t}toString(){let t="Notification Name: "+this.name;return t+="\nBody:"+(null==this.body?"null":this.body.toString()),t+="\nType:"+(null==this.type?"null":this.type),t}}class s{constructor(t){if(null!=s.instanceMap[t])throw new Error(s.MULTITON_MSG);this.initializeNotifier(t),s.instanceMap.set(this.multitonKey,this),this.initializeFacade()}initializeFacade(){this.initializeModel(),this.initializeController(),this.initializeView()}static getInstance(t,e){return null==s.instanceMap&&(s.instanceMap=new Map),null==s.instanceMap.get(t)&&s.instanceMap.set(t,e(t)),s.instanceMap.get(t)}initializeModel(){null==this.model&&(this.model=n.getInstance(this.multitonKey,(t=>new n(t))))}initializeController(){null==this.controller&&(this.controller=i.getInstance(this.multitonKey,(t=>new i(t))))}initializeView(){null==this.view&&(this.view=e.getInstance(this.multitonKey,(t=>new e(t))))}registerCommand(t,e){this.controller.registerCommand(t,e)}hasCommand(t){return this.controller.hasCommand(t)}removeCommand(t){this.controller.removeCommand(t)}registerProxy(t){this.model.registerProxy(t)}removeProxy(t){return this.model.removeProxy(t)}hasProxy(t){return this.model.hasProxy(t)}retrieveProxy(t){return this.model.retrieveProxy(t)}registerMediator(t){this.view.registerMediator(t)}removeMediator(t){return this.view.removeMediator(t)}hasMediator(t){return this.view.hasMediator(t)}retrieveMediator(t){return this.view.retrieveMediator(t)}sendNotification(t,e=null,i=""){this.notifyObservers(new r(t,e,i))}notifyObservers(t){this.view.notifyObservers(t)}initializeNotifier(t){this.multitonKey=t}static hasCore(t){return this.instanceMap.has(t)}static removeCore(t){null!=s.instanceMap.get(t)&&(n.removeModel(t),e.removeView(t),i.removeController(t),this.instanceMap.delete(t))}static get MULTITON_MSG(){return"Facade instance for this Multiton key already constructed!"}}class o{constructor(){}sendNotification(t,e=null,i=""){null!=this.facade&&this.facade.sendNotification(t,e,i)}initializeNotifier(t){this.multitonKey=t}get facade(){if(null==this.multitonKey)throw new Error(o.MULTITON_MSG);return s.getInstance(this.multitonKey,(t=>new s(t)))}static get MULTITON_MSG(){return"multitonKey for this Notifier not yet initialized!"}}class a extends o{constructor(){super()}execute(t){}}class l extends o{constructor(t,e=null){super(),this._mediatorName=t||l.NAME,this._viewComponent=e}onRegister(){}onRemove(){}listNotificationInterests(){return[]}handleNotification(t){}get mediatorName(){return this._mediatorName}get viewComponent(){return this._viewComponent}set viewComponent(t){this._viewComponent=t}static get NAME(){return"Mediator"}}class h extends o{constructor(t,e=null){super(),this._proxyName=t||h.NAME,this._data=e}onRegister(){}onRemove(){}get proxyName(){return this._proxyName}get data(){return this._data}set data(t){this._data=t}static get NAME(){return"Proxy"}}exports.Controller=i,exports.Facade=s,exports.MacroCommand=class extends a{constructor(){super(),this.subCommands=[],this.initializeMacroCommand()}initializeMacroCommand(){}addSubCommand(t){this.subCommands.push(t)}execute(t){for(;this.subCommands.length>0;){let e=this.subCommands.shift()();e.initializeNotifier(this.multitonKey),e.execute(t)}}},exports.Mediator=l,exports.Model=n,exports.Notification=r,exports.Notifier=o,exports.Observer=t,exports.Proxy=h,exports.SimpleCommand=a,exports.View=e;
-//# sourceMappingURL=puremvc.min.cjs.map
diff --git a/bin/cjs/puremvc.min.cjs.map b/bin/cjs/puremvc.min.cjs.map
deleted file mode 100644
index 9bf7af3..0000000
--- a/bin/cjs/puremvc.min.cjs.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"puremvc.min.cjs","sources":["../../src/patterns/observer/Observer.js","../../src/core/View.js","../../src/core/Controller.js","../../src/core/Model.js","../../src/patterns/observer/Notification.js","../../src/patterns/facade/Facade.js","../../src/patterns/observer/Notifier.js","../../src/patterns/command/SimpleCommand.js","../../src/patterns/mediator/Mediator.js","../../src/patterns/proxy/Proxy.js","../../src/patterns/command/MacroCommand.js"],"sourcesContent":["/*\n * Observer.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\n/**\n * A base `Observer` implementation.\n *\n * An `Observer` is an object that encapsulates information\n * about an interested object with a method that should\n * be called when a particular `Notification` is broadcast.
\n *\n * In PureMVC, the `Observer` class assumes these responsibilities:
\n *\n * \n * - Encapsulate the notification (callback) method of the interested object.
\n * - Encapsulate the notification context (this) of the interested object.
\n * - Provide methods for setting the notification method and context.
\n * - Provide a method for notifying the interested object.
\n *
\n *\n * @class Observer\n */\nclass Observer {\n\n /**\n * Constructor.\n *\n * The notification method on the interested object should take\n * one parameter of type `Notification`
\n *\n * @param {function(Notification):void} notifyMethod\n * @param {Object} notifyContext\n */\n constructor(notifyMethod, notifyContext) {\n this._notifyMethod = notifyMethod;\n this._notifyContext = notifyContext;\n }\n\n /**\n * Notify the interested object.\n *\n * @param {Notification} notification\n */\n notifyObserver(notification) {\n this._notifyMethod.call(this._notifyContext, notification);\n }\n\n /**\n * Compare an object to the notification context.\n *\n * @param {Object} notifyContext\n * @returns {boolean}\n */\n compareNotifyContext(notifyContext) {\n return this._notifyContext === notifyContext;\n }\n\n /**\n * Get the notification method.\n *\n * @returns {function(Notification):void}\n */\n get notifyMethod() {\n return this._notifyMethod\n }\n\n /**\n * Set the notification method.\n *\n * The notification method should take one parameter of type `Notification`.
\n *\n * @param {function(Notification): void} notifyMethod - The function to be called when a notification is received.\n */\n set notifyMethod(notifyMethod) {\n this._notifyMethod = notifyMethod;\n }\n\n /**\n * Get the notifyContext\n *\n * @returns {Object}\n */\n get notifyContext() {\n return this._notifyContext;\n }\n\n /**\n * Set the notification context.\n *\n * @param {Object} notifyContext\n */\n set notifyContext(notifyContext) {\n this._notifyContext = notifyContext;\n }\n\n}\nexport { Observer }\n","/*\n * View.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Observer} from \"../patterns/observer/Observer.js\";\n\n/**\n * A Multiton `View` implementation.\n *\n * In PureMVC, the `View` class assumes these responsibilities:
\n *\n * \n * - Maintain a cache of `Mediator` instances.
\n * - Provide methods for registering, retrieving, and removing `Mediators`.
\n * - Notifying `Mediators` when they are registered or removed.
\n * - Managing the observer lists for each `Notification` in the application.
\n * - Providing a method for attaching `Observers` to a `Notification`'s observer list.
\n * - Providing a method for broadcasting a `Notification`.
\n * - Notifying the `Observers` of a given `Notification` when it broadcast.
\n *
\n *\n * @see Mediator Mediator\n * @see Observer Observer\n * @see Notification Notification\n *\n * @class View\n */\nclass View {\n\n /**\n * Constructor.\n *\n * This `View` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Multiton\n * Factory method `View.getInstance( multitonKey )`\n *\n * @constructor\n * @param {string} key\n *\n * @throws {Error} Error if instance for this Multiton key has already been constructed\n */\n constructor(key) {\n if (View.instanceMap.get(key) != null) throw new Error(View.MULTITON_MSG);\n /** @protected\n * @type {string} */\n this.multitonKey = key;\n View.instanceMap.set(this.multitonKey, this);\n /** @protected\n * @type {Map} */\n this.mediatorMap = new Map();\n /** @protected\n * @type {Map.>} */\n this.observerMap = new Map();\n this.initializeView();\n }\n\n /**\n * Initialize the Multiton View instance.
\n *\n * Called automatically by the constructor, this\n * is your opportunity to initialize the Multiton\n * instance in your subclass without overriding the\n * constructor.
\n */\n initializeView() {\n\n }\n\n /**\n * View Multiton factory method.\n *\n * @static\n * @param {string} key\n * @param {function(string):View} factory\n * @returns {View} the Multiton instance of `View`\n */\n static getInstance(key, factory) {\n if (View.instanceMap == null)\n /** @static\n * @type {Map} */\n View.instanceMap = new Map();\n if (View.instanceMap.get(key) == null) View.instanceMap.set(key, factory(key));\n return View.instanceMap.get(key);\n }\n\n /**\n * Register an `Observer` to be notified\n * of `Notifications` with a given name.
\n *\n * @param {string} notificationName the name of the `Notifications` to notify this `Observer` of\n * @param {Observer} observer the `Observer` to register\n */\n registerObserver(notificationName, observer) {\n if (this.observerMap.get(notificationName) != null) {\n let observers = this.observerMap.get(notificationName);\n observers.push(observer);\n } else {\n this.observerMap.set(notificationName, new Array(observer));\n }\n }\n\n /**\n * Notify the `Observers` for a particular `Notification`.
\n *\n * All previously attached `Observers` for this `Notification`'s\n * list are notified and are passed a reference to the `Notification` in\n * the order in which they were registered.
\n *\n * @param {Notification} notification the `Notification` to notify `Observers` of.\n */\n notifyObservers(notification) {\n if (this.observerMap.has(notification.name)) {\n // Copy observers from reference array to working array,\n // since the reference array may change during the notification loop\n let observers = this.observerMap.get(notification.name).slice();\n\n // Notify Observers from the working array\n for(let i = 0; i < observers.length; i++) {\n observers[i].notifyObserver(notification);\n }\n }\n }\n\n /**\n * Remove the observer for a given notifyContext from an observer list for a given Notification name.
\n *\n * @param {string} notificationName which observer list to remove from\n * @param {Object} notifyContext remove the observer with this object as its notifyContext\n */\n removeObserver(notificationName, notifyContext) {\n // the observer list for the notification under inspection\n let observers = this.observerMap.get(notificationName);\n\n // find the observer for the notifyContext\n for (let i = 0; i < observers.length; i++) {\n if (observers[i].compareNotifyContext(notifyContext) === true) {\n // there can only be one Observer for a given notifyContext\n // in any given Observer list, so remove it and break\n observers.splice(i, 1);\n break;\n }\n }\n\n // Also, when a Notification's Observer list length falls to\n // zero, delete the notification key from the observer map\n if (observers.length === 0) {\n this.observerMap.delete(notificationName);\n }\n }\n\n /**\n * Register a `Mediator` instance with the `View`.\n *\n * Registers the `Mediator` so that it can be retrieved by name,\n * and further interrogates the `Mediator` for its\n * `Notification` interests.
\n *\n * If the `Mediator` returns any `Notification`\n * names to be notified about, an `Observer` is created encapsulating\n * the `Mediator` instance's `handleNotification` method\n * and registering it as an `Observer` for all `Notifications` the\n * `Mediator` is interested in.
\n *\n * @param {Mediator} mediator a reference to the `Mediator` instance\n */\n registerMediator(mediator) {\n // do not allow re-registration (you must to removeMediator fist)\n if (this.mediatorMap.has(mediator.mediatorName) !== false) return;\n\n mediator.initializeNotifier(this.multitonKey);\n\n // Register the Mediator for retrieval by name\n this.mediatorMap.set(mediator.mediatorName, mediator);\n\n // Get Notification interests, if any.\n let interests = mediator.listNotificationInterests();\n\n // Register Mediator as an observer for each notification of interests\n if (interests.length > 0) {\n // Create Observer referencing this mediator's handleNotification method\n let observer = new Observer(mediator.handleNotification.bind(mediator), mediator); // check bind\n\n // Register Mediator as Observer for its list of Notification interests\n for (let i = 0; i < interests.length; i++) {\n this.registerObserver(interests[i], observer);\n }\n }\n\n // alert the mediator that it has been registered\n mediator.onRegister();\n }\n\n /**\n * Retrieve a `Mediator` from the `View`.\n *\n * @param {string} mediatorName the name of the `Mediator` instance to retrieve.\n * @returns {Mediator} the `Mediator` instance previously registered with the given `mediatorName`.\n */\n retrieveMediator(mediatorName) {\n return this.mediatorMap.get(mediatorName) || null;\n }\n\n /**\n * Remove a `Mediator` from the `View`.\n *\n * @param {string} mediatorName name of the `Mediator` instance to be removed.\n * @returns {Mediator} the `Mediator` that was removed from the `View`\n */\n removeMediator(mediatorName) {\n // Retrieve the named mediator\n let mediator = this.mediatorMap.get(mediatorName);\n\n if (mediator) {\n // for every notification this mediator is interested in...\n let interests = mediator.listNotificationInterests();\n for (let i = 0; i < interests.length; i++) {\n // remove the observer linking the mediator\n // to the notification interest\n this.removeObserver(interests[i], mediator);\n }\n\n // remove the mediator from the map\n this.mediatorMap.delete(mediatorName);\n\n // alert the mediator that it has been removed\n mediator.onRemove();\n }\n\n return mediator;\n }\n\n /**\n * Check if a Mediator is registered or not\n *\n * @param {string} mediatorName\n * @returns {boolean} whether a Mediator is registered with the given `mediatorName`.\n */\n hasMediator(mediatorName) {\n return this.mediatorMap.has(mediatorName);\n }\n\n /**\n * Remove a View instance\n *\n * @static\n * @param key multitonKey of View instance to remove\n */\n static removeView(key) {\n this.instanceMap.delete(key);\n }\n\n /**\n * Message Constants\n *\n * @static\n * @type {string}\n */\n static get MULTITON_MSG() { return \"View instance for this Multiton key already constructed!\" };\n\n}\nexport { View }\n","/*\n * Controller.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {View} from \"./View.js\"\nimport {Observer} from \"../patterns/observer/Observer.js\";\n\n/**\n * A Multiton `Controller` implementation.\n *\n * In PureMVC, the `Controller` class follows the\n * 'Command and Controller' strategy, and assumes these\n * responsibilities:
\n *\n * \n * - Remembering which `Command`s\n * are intended to handle which `Notifications`.
\n * - Registering itself as an `Observer` with\n * the `View` for each `Notification`\n * that it has a `Command` mapping for.
\n * - Creating a new instance of the proper `Command`\n * to handle a given `Notification` when notified by the `View`.
\n * - Calling the `Command`'s `execute`\n * method, passing in the `Notification`.
\n *
\n *\n * Your application must register `Commands` with the\n * Controller.
\n *\n * The simplest way is to subclass `Facade`,\n * and use its `initializeController` method to add your\n * registrations.
\n *\n * @see View View\n * @see Observer Observer\n * @see Notification Notification\n * @see SimpleCommand SimpleCommand\n * @see MacroCommand MacroCommand\n *\n * @class Controller\n */\nclass Controller {\n\n /**\n * Constructor.\n *\n * This `Controller` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Factory method,\n * passing the unique key for this instance\n * `Controller.getInstance( multitonKey )`
\n *\n * @throws {Error} Error if instance for this Multiton key has already been constructed\n *\n * @constructor\n * @param {string} key\n */\n constructor(key) {\n if (Controller.instanceMap[key] != null) throw new Error(Controller.MULTITON_MSG);\n /** @protected\n * @type {string} */\n this.multitonKey = key;\n Controller.instanceMap.set(this.multitonKey, this);\n /** @protected\n * @type {Map} */\n this.commandMap = new Map();\n this.initializeController();\n }\n\n /**\n * Initialize the Multiton `Controller` instance.\n *\n * Called automatically by the constructor.
\n *\n * Note that if you are using a subclass of `View`\n * in your application, you should also subclass `Controller`\n * and override the `initializeController` method in the\n * following way:
\n *\n * `\n *\t\t// ensure that the Controller is talking to my View implementation\n *\t\tinitializeController( )\n *\t\t{\n *\t\t\tthis.view = MyView.getInstance(this.multitonKey, (key) => new MyView(key));\n *\t\t}\n * `
\n *\n */\n initializeController() {\n /** @protected\n * @type {View} **/\n this.view = View.getInstance(this.multitonKey, (key) => new View(key));\n }\n\n /**\n * `Controller` Multiton Factory method.\n *\n * @static\n * @param {string} key\n * @param {function(string):Controller} factory\n * @returns {Controller} the Multiton instance of `Controller`\n */\n static getInstance(key, factory) {\n if (Controller.instanceMap == null)\n /** @static\n @type {Map} */\n Controller.instanceMap = new Map();\n if (Controller.instanceMap.get(key) == null) Controller.instanceMap.set(key, factory(key));\n return Controller.instanceMap.get(key);\n }\n\n /**\n * If a `Command` has previously been registered\n * to handle the given `Notification`, then it is executed.
\n *\n * @param {Notification} notification a `Notification`\n */\n executeCommand(notification) {\n let factory = this.commandMap.get(notification.name);\n if (factory == null) return;\n\n let commandInstance = factory();\n commandInstance.initializeNotifier(this.multitonKey);\n commandInstance.execute(notification);\n }\n\n /**\n * Register a particular `Command` class as the handler\n * for a particular `Notification`.
\n *\n * If an `Command` has already been registered to\n * handle `Notification`s with this name, it is no longer\n * used, the new `Command` is used instead.
\n *\n * The Observer for the new Command is only created if this the\n * first time a Command has been registered for this Notification name.
\n *\n * @param notificationName the name of the `Notification`\n * @param {function():SimpleCommand} factory\n */\n registerCommand(notificationName, factory) {\n if (this.commandMap.get(notificationName) == null) {\n this.view.registerObserver(notificationName, new Observer(this.executeCommand, this));\n }\n this.commandMap.set(notificationName, factory);\n }\n\n /**\n * Check if a Command is registered for a given Notification\n *\n * @param {string} notificationName\n * @return {boolean} whether a Command is currently registered for the given `notificationName`.\n */\n hasCommand(notificationName) {\n return this.commandMap.has(notificationName);\n }\n\n /**\n * Remove a previously registered `Command` to `Notification` mapping.\n *\n * @param {string} notificationName the name of the `Notification` to remove the `Command` mapping for\n */\n removeCommand(notificationName) {\n // if the Command is registered...\n if(this.hasCommand(notificationName)) {\n // remove the observer\n this.view.removeObserver(notificationName, this);\n\n // remove the command\n this.commandMap.delete(notificationName)\n }\n }\n\n /**\n * Remove a Controller instance\n *\n * @static\n * @param {string} key of Controller instance to remove\n */\n static removeController(key) {\n Controller.instanceMap.delete(key);\n }\n\n /**\n * Message Constants\n *\n * @static\n * @type {string}\n */\n static get MULTITON_MSG() { return \"Controller instance for this Multiton key already constructed!\" };\n}\nexport { Controller }\n","/*\n * Model.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\n/**\n * A Multiton `Model` implementation.\n *\n * In PureMVC, the `Model` class provides\n * access to model objects (Proxies) by named lookup.\n *\n *
The `Model` assumes these responsibilities:
\n *\n * \n * - Maintain a cache of `Proxy` instances.
\n * - Provide methods for registering, retrieving, and removing\n * `Proxy` instances.
\n *
\n *\n * Your application must register `Proxy` instances\n * with the `Model`. Typically, you use an\n * `Command` to create and register `Proxy`\n * instances once the `Facade` has initialized the Core\n * actors.
\n *\n * @see Proxy Proxy\n *\n * @class Model\n */\n\nclass Model {\n\n /**\n * Constructor.\n *\n * This `Model` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Multiton\n * Factory method `Model.getInstance( multitonKey )`\n *\n * @constructor\n * @param {string} key\n *\n * @throws {Error} Error if instance for this Multiton key instance has already been constructed\n */\n constructor(key) {\n if (Model.instanceMap.get(key) != null) throw new Error(Model.MULTITON_MSG);\n /** @protected\n * @type {string} */\n this.multitonKey = key;\n Model.instanceMap.set(this.multitonKey, this);\n /** @protected\n * @type {Map} */\n this.proxyMap = new Map();\n this.initializeModel();\n }\n\n /**\n * Initialize the `Model` instance.\n *\n * Called automatically by the constructor, this\n * is your opportunity to initialize the Multiton\n * instance in your subclass without overriding the\n * constructor.
\n *\n */\n initializeModel() {\n\n }\n\n /**\n * `Model` Multiton Factory method.\n *\n * @static\n * @param {string} key\n * @param {function(string):Model} factory\n * @returns {Model} the instance for this Multiton key\n */\n static getInstance(key, factory) {\n if (Model.instanceMap == null)\n /** @static\n @type {Map} */\n Model.instanceMap = new Map();\n if (Model.instanceMap.get(key) == null) Model.instanceMap.set(key, factory(key));\n return Model.instanceMap.get(key);\n }\n\n /**\n * Register a `Proxy` with the `Model`.\n *\n * @param {Proxy} proxy a `Proxy` to be held by the `Model`.\n */\n registerProxy(proxy) {\n proxy.initializeNotifier(this.multitonKey);\n this.proxyMap.set(proxy.proxyName, proxy);\n proxy.onRegister();\n }\n\n /**\n * Retrieve a `Proxy` from the `Model`.\n *\n * @param {string} proxyName\n * @returns {Proxy} the `Proxy` instance previously registered with the given `proxyName`.\n */\n retrieveProxy(proxyName) {\n return this.proxyMap.get(proxyName) || null;\n }\n\n /**\n * Check if a Proxy is registered\n *\n * @param {string} proxyName\n * @returns {boolean} whether a Proxy is currently registered with the given `proxyName`.\n */\n hasProxy(proxyName) {\n return this.proxyMap.has(proxyName);\n }\n\n /**\n * Remove a `Proxy` from the `Model`.\n *\n * @param {string} proxyName name of the `Proxy` instance to be removed.\n * @returns {Proxy} the `Proxy` that was removed from the `Model`\n */\n removeProxy(proxyName) {\n let proxy = this.proxyMap.get(proxyName);\n if (proxy != null) {\n this.proxyMap.delete(proxyName);\n proxy.onRemove();\n }\n return proxy;\n }\n\n /**\n * Remove a Model instance\n *\n * @static\n * @param key\n */\n static removeModel(key) {\n Model.instanceMap.delete(key);\n }\n\n /**\n * @static\n * @type {string}\n */\n static get MULTITON_MSG() { return \"Model instance for this Multiton key already constructed!\" };\n}\nexport { Model }","/*\n * Notification.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\n/**\n *\n * A base `Notification` implementation.\n *\n * PureMVC does not rely upon underlying event models such\n * as the one provided with Flash, and ActionScript 3 does\n * not have an inherent event model.
\n *\n * The Observer Pattern as implemented within PureMVC exists\n * to support event-driven communication between the\n * application and the actors of the MVC triad.
\n *\n * Notifications are not meant to be a replacement for Events\n * in Flex/Flash/Apollo. Generally, `Mediator` implementors\n * place event listeners on their view components, which they\n * then handle in the usual way. This may lead to the broadcast of `Notification`s to\n * trigger `Command`s or to communicate with other `Mediators`. `Proxy` and `Command`\n * instances communicate with each other and `Mediator`s\n * by broadcasting `Notification`s.
\n *\n * A key difference between Flash `Event`s and PureMVC\n * `Notification`s is that `Event`s follow the\n * 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy\n * until some parent component handles the `Event`, while\n * PureMVC `Notification`s follow a 'Publish/Subscribe'\n * pattern. PureMVC classes need not be related to each other in a\n * parent/child relationship in order to communicate with one another\n * using `Notification`s.
\n *\n * @class Notification\n */\nclass Notification {\n\n /**\n * Constructor.\n *\n * @constructor\n * @param {string} name - The name of the notification.\n * @param {Object|null} [body=null] - The body of the notification, defaults to `null`.\n * @param {string} [type=\"\"] - The type of the notification, defaults to an empty string.\n */\n constructor(name, body = null, type = \"\") {\n this._name = name;\n this._body = body;\n this._type = type;\n }\n\n /**\n * Get the name of the `Notification` instance.\n *\n * @returns {string}\n */\n get name() {\n return this._name;\n }\n\n /**\n * Get the body of the `Notification` instance.\n *\n * @returns {Object}\n */\n get body() {\n return this._body;\n }\n\n /**\n * Set the body of the `Notification` instance.\n *\n * @param {Object|null} body\n */\n set body(body) {\n this._body = body;\n }\n\n /**\n * Get the type of the `Notification` instance.\n *\n * @returns {string}\n */\n get type() {\n return this._type;\n }\n\n /**\n * Set the type of the `Notification` instance.\n *\n * @param {string} type\n */\n set type(type) {\n this._type = type;\n }\n\n /**\n * Get the string representation of the `Notification` instance.\n *\n * @returns {string}\n */\n toString() {\n let str= \"Notification Name: \" + this.name;\n str+= \"\\nBody:\" + ((this.body == null ) ? \"null\" : this.body.toString());\n str+= \"\\nType:\" + ((this.type == null ) ? \"null\" : this.type);\n return str;\n }\n\n}\nexport { Notification }\n","/*\n * Facade.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Controller} from \"../../core/Controller.js\";\nimport {Model} from \"../../core/Model.js\";\nimport {View} from \"../../core/View.js\";\nimport {Notification} from \"../observer/Notification.js\";\n\n/**\n * A base Multiton `Facade` implementation.\n *\n * @see Model Model\n * @see View View\n * @see Controller Controller\n *\n * @class Facade\n */\nclass Facade {\n\n /**\n * Constructor.\n *\n * This `Facade` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Factory method,\n * passing the unique key for this instance\n * `Facade.getInstance( multitonKey )`
\n *\n * @constructor\n * @param {string} key\n * @throws {Error} Error if instance for this Multiton key has already been constructed\n */\n constructor(key) {\n if (Facade.instanceMap[key] != null) throw new Error(Facade.MULTITON_MSG);\n this.initializeNotifier(key);\n Facade.instanceMap.set(this.multitonKey, this);\n this.initializeFacade();\n }\n\n /**\n * Initialize the Multiton `Facade` instance.\n *\n * Called automatically by the constructor. Override in your\n * subclass to do any subclass specific initializations. Be\n * sure to call `super.initializeFacade()`, though.
\n */\n initializeFacade() {\n this.initializeModel();\n this.initializeController();\n this.initializeView();\n }\n\n /**\n * Facade Multiton Factory method\n *\n * @static\n * @param {string} key\n * @param {function(string):Facade} factory\n * @returns {Facade} the Multiton instance of the Facade\n */\n static getInstance(key, factory) {\n if (Facade.instanceMap == null)\n /** @static\n * @type {Map} */\n Facade.instanceMap = new Map();\n if (Facade.instanceMap.get(key) == null) Facade.instanceMap.set(key, factory(key));\n return Facade.instanceMap.get(key);\n }\n\n /**\n * Initialize the `Model`.\n *\n * Called by the `initializeFacade` method.\n * Override this method in your subclass of `Facade`\n * if one or both of the following are true:
\n *\n * \n * - You wish to initialize a different `Model`.
\n * - You have `Proxy`s to register with the Model that do not\n * retrieve a reference to the Facade at construction time.`
\n *
\n *\n * If you don't want to initialize a different `Model`,\n * call `super.initializeModel()` at the beginning of your\n * method, then register `Proxy`s.\n *\n * Note: This method is rarely overridden; in practice you are more\n * likely to use a `Command` to create and register `Proxy`s\n * with the `Model`, since `Proxy`s with mutable data will likely\n * need to send `Notification`s and thus will likely want to fetch a reference to\n * the `Facade` during their construction.
\n */\n initializeModel() {\n if (this.model != null) return;\n this.model = Model.getInstance(this.multitonKey, key => new Model(key));\n }\n\n /**\n * Initialize the `Controller`.\n *\n * Called by the `initializeFacade` method.\n * Override this method in your subclass of `Facade`\n * if one or both of the following are true:
\n *\n * \n * - You wish to initialize a different `Controller`.
\n * - You have `Commands` to register with the `Controller` at startup.`.
\n *
\n *\n * If you don't want to initialize a different `Controller`,\n * call `super.initializeController()` at the beginning of your\n * method, then register `Command`s.
\n */\n initializeController() {\n if (this.controller != null) return;\n this.controller = Controller.getInstance(this.multitonKey, key => new Controller(key));\n }\n\n /**\n * Initialize the `View`.\n *\n * Called by the `initializeFacade` method.\n * Override this method in your subclass of `Facade`\n * if one or both of the following are true:
\n *\n * \n * - You wish to initialize a different `View`.
\n * - You have `Observers` to register with the `View`
\n *
\n *\n * If you don't want to initialize a different `View`,\n * call `super.initializeView()` at the beginning of your\n * method, then register `Mediator` instances.
\n *\n * Note: This method is rarely overridden; in practice you are more\n * likely to use a `Command` to create and register `Mediator`s\n * with the `View`, since `Mediator` instances will need to send\n * `Notification`s and thus will likely want to fetch a reference\n * to the `Facade` during their construction.
\n */\n initializeView() {\n if (this.view != null) return;\n this.view = View.getInstance(this.multitonKey, key => new View(key));\n }\n\n /**\n * Register a `Command` with the `Controller` by Notification name.\n *\n * @param {string} notificationName the name of the `Notification` to associate the `Command` with\n * @param {function():SimpleCommand} factory a reference to the factory of the `Command`\n */\n registerCommand(notificationName, factory) {\n this.controller.registerCommand(notificationName, factory);\n }\n\n /**\n * Check if a Command is registered for a given Notification\n *\n * @param {string} notificationName\n * @returns {boolean} whether a Command is currently registered for the given `notificationName`.\n */\n hasCommand(notificationName) {\n return this.controller.hasCommand(notificationName);\n }\n\n /**\n * Remove a previously registered `Command` to `Notification` mapping from the Controller.\n *\n * @param {string} notificationName the name of the `Notification` to remove the `Command` mapping for\n */\n removeCommand(notificationName) {\n this.controller.removeCommand(notificationName);\n }\n\n /**\n * Register a `Proxy` with the `Model` by name.\n *\n * @param {Proxy} proxy the `Proxy` instance to be registered with the `Model`.\n */\n registerProxy(proxy) {\n this.model.registerProxy(proxy);\n }\n\n /**\n * Remove a `Proxy` from the `Model` by name.\n *\n * @param {string} proxyName the `Proxy` to remove from the `Model`.\n * @returns {Proxy} the `Proxy` that was removed from the `Model`\n */\n removeProxy(proxyName) {\n return this.model.removeProxy(proxyName);\n }\n\n /**\n * Check if a Proxy is registered\n *\n * @param {string} proxyName\n * @returns {boolean} whether a Proxy is currently registered with the given `proxyName`.\n */\n hasProxy(proxyName) {\n return this.model.hasProxy(proxyName);\n }\n\n /**\n * Retrieve a `Proxy` from the `Model` by name.\n *\n * @param {string} proxyName the name of the proxy to be retrieved.\n * @returns {Proxy} the `Proxy` instance previously registered with the given `proxyName`.\n */\n retrieveProxy(proxyName) {\n return this.model.retrieveProxy(proxyName);\n }\n\n /**\n * Register a `Mediator` with the `View`.\n *\n * @param {Mediator} mediator a reference to the `Mediator`\n */\n registerMediator(mediator) {\n this.view.registerMediator(mediator);\n }\n\n /**\n * Remove a `Mediator` from the `View`.\n *\n * @param {string} mediatorName name of the `Mediator` to be removed.\n * @returns {Mediator} the `Mediator` that was removed from the `View`\n */\n removeMediator(mediatorName) {\n return this.view.removeMediator(mediatorName);\n }\n\n /**\n * Check if a Mediator is registered or not\n *\n * @param {string} mediatorName\n * @returns {boolean} whether a Mediator is registered with the given `mediatorName`.\n */\n hasMediator(mediatorName) {\n return this.view.hasMediator(mediatorName);\n }\n\n /**\n * Retrieve a `Mediator` from the `View`.\n *\n * @param {string} mediatorName\n * @returns {Mediator} the `Mediator` previously registered with the given `mediatorName`.\n */\n retrieveMediator(mediatorName) {\n return this.view.retrieveMediator(mediatorName);\n }\n\n /**\n * Create and send an `Notification`.\n *\n * Keeps us from having to construct new notification\n * instances in our implementation code.
\n *\n * @param {string} notificationName the name of the notification to send\n * @param {Object} [body] body the body of the notification (optional)\n * @param {string} [type] type the type of the notification (optional)\n */\n sendNotification(notificationName, body = null, type = \"\") {\n this.notifyObservers(new Notification(notificationName, body, type));\n }\n\n /**\n * Notify `Observer`s.\n *\n * This method is left public mostly for backward\n * compatibility, and to allow you to send custom\n * notification classes using the facade.
\n *\n * Usually you should just call sendNotification\n * and pass the parameters, never having to\n * construct the notification yourself.
\n *\n * @param {Notification} notification the `Notification` to have the `View` notify `Observers` of.\n */\n notifyObservers(notification) {\n this.view.notifyObservers(notification);\n }\n\n /**\n * Set the Multiton key for this facade instance.\n *\n * Not called directly, but instead from the\n * constructor when getInstance is invoked.\n * It is necessary to be public in order to\n * implement Notifier.
\n */\n initializeNotifier(key) {\n this.multitonKey = key;\n }\n\n /**\n * Check if a Core is registered or not\n *\n * @static\n * @param {string} key the multiton key for the Core in question\n * @returns {boolean} whether a Core is registered with the given `key`.\n */\n static hasCore(key) {\n return this.instanceMap.has(key);\n }\n\n /**\n * Remove a Core.\n *\n * Remove the Model, View, Controller and Facade\n * instances for the given key.
\n *\n * @static\n * @param {string} key multitonKey of the Core to remove\n */\n static removeCore(key) {\n if (Facade.instanceMap.get(key) == null) return;\n Model.removeModel(key);\n View.removeView(key);\n Controller.removeController(key);\n this.instanceMap.delete(key);\n }\n\n /**\n * Message Constants\n *\n * @static\n * @returns {string}\n */\n static get MULTITON_MSG() {return \"Facade instance for this Multiton key already constructed!\"};\n}\nexport { Facade }\n","/*\n * Notifier.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Facade} from \"../facade/Facade.js\";\n\n/**\n * A Base `Notifier` implementation.\n *\n * `MacroCommand, Command, Mediator` and `Proxy`\n * all have a need to send `Notifications`.
\n *\n *
The `Notifier` interface provides a common method called\n * `sendNotification` that relieves implementation code of\n * the necessity to actually construct `Notifications`.
\n *\n * The `Notifier` class, which all the above-mentioned classes\n * extend, provides an initialized reference to the `Facade`\n * Multiton, which is required for the convenience method\n * for sending `Notifications`, but also eases implementation as these\n * classes have frequent `Facade` interactions and usually require\n * access to the facade anyway.
\n *\n * NOTE: In the MultiCore version of the framework, there is one caveat to\n * notifiers, they cannot send notifications or reach the facade until they\n * have a valid multitonKey.
\n *\n * The multitonKey is set:\n * * on a Command when it is executed by the Controller\n * * on a Mediator is registered with the View\n * * on a Proxy is registered with the Model.\n *\n * @see Proxy Proxy\n * @see Facade Facade\n * @see Mediator Mediator\n * @see MacroCommand MacroCommand\n * @see SimpleCommand SimpleCommand\n *\n * @class Notifier\n */\nclass Notifier {\n\n constructor() {}\n\n /**\n * Create and send an `Notification`.\n *\n * Keeps us from having to construct new Notification\n * instances in our implementation code.
\n *\n * @param {string} notificationName\n * @param {Object} [body] body\n * @param {string} [type] type\n */\n sendNotification (notificationName, body = null, type = \"\") {\n if (this.facade != null) {\n this.facade.sendNotification(notificationName, body, type);\n }\n }\n\n /**\n * Initialize this Notifier instance.\n *\n * This is how a Notifier gets its multitonKey.\n * Calls to sendNotification or to access the\n * facade will fail until after this method\n * has been called.
\n *\n * Mediators, Commands or Proxies may override\n * this method in order to send notifications\n * or access the Multiton Facade instance as\n * soon as possible. They CANNOT access the facade\n * in their constructors, since this method will not\n * yet have been called.
\n *\n * @param {string} key the multitonKey for this Notifier to use\n */\n initializeNotifier(key) {\n this.multitonKey = key;\n }\n\n /**\n * Return the Multiton Facade instance\n *\n * @typedef {Facade} Facade\n *\n * @throws {Error}\n */\n get facade() {\n if (this.multitonKey == null) throw new Error(Notifier.MULTITON_MSG);\n return Facade.getInstance(this.multitonKey, key => new Facade(key));\n }\n\n /**\n * Message Constants\n *\n * @static\n * @returns {string}\n */\n static get MULTITON_MSG() { return \"multitonKey for this Notifier not yet initialized!\" }\n}\nexport { Notifier }\n","/*\n * SimpleCommand.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Notifier} from \"../observer/Notifier.js\";\n\n/**\n * A base `Command` implementation.\n *\n * Your subclass should override the `execute`\n * method where your business logic will handle the `Notification`.
\n *\n * @see Controller Controller\n * @see Notification Notification\n * @see MacroCommand MacroCommand\n *\n * @class SimpleCommand\n */\nclass SimpleCommand extends Notifier {\n\n constructor() {\n super();\n }\n\n /**\n * Fulfill the use-case initiated by the given `Notification`.\n *\n * In the Command Pattern, an application use-case typically\n * begins with some user action, which results in a `Notification` being broadcast, which\n * is handled by business logic in the `execute` method of an\n * `Command`.
\n *\n * @param {Notification} notification\n */\n execute(notification) {\n\n }\n\n}\nexport { SimpleCommand }\n","/*\n * Mediator.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Notifier} from \"../observer/Notifier.js\";\n\n/**\n * A base `Mediator` implementation.\n *\n * @see View View\n *\n * @class Mediator\n */\nclass Mediator extends Notifier {\n\n /**\n * Constructor.\n *\n * @constructor\n * @param {string} mediatorName\n * @param {Object} [viewComponent] viewComponent\n */\n constructor(mediatorName, viewComponent = null) {\n super();\n this._mediatorName = mediatorName || Mediator.NAME;\n this._viewComponent = viewComponent;\n }\n\n /**\n * Called by the View when the Mediator is registered\n */\n onRegister() {\n\n }\n\n /**\n * Called by the View when the Mediator is removed\n */\n onRemove() {\n\n }\n\n /**\n * List the `Notification` names this\n * `Mediator` is interested in being notified of.\n *\n * @returns {string[]}\n */\n listNotificationInterests() {\n return [];\n }\n\n /**\n * Handle `Notification`s.\n *\n * \n * Typically this will be handled in a switch statement,\n * with one 'case' entry per `Notification`\n * the `Mediator` is interested in.\n *\n * @param {Notification} notification\n */\n handleNotification(notification) {\n\n }\n\n /**\n * the mediator name\n *\n * @returns {string}\n */\n get mediatorName() {\n return this._mediatorName;\n }\n\n /**\n * Get the `Mediator`'s view component.\n *\n *
\n * Additionally, an implicit getter will usually\n * be defined in the subclass that casts the view\n * object to a type, like this:
\n *\n * @returns {Object}\n */\n get viewComponent() {\n return this._viewComponent;\n }\n\n /**\n * Set the `Mediator`'s view component.\n *\n * @param {Object} viewComponent\n */\n set viewComponent(viewComponent) {\n this._viewComponent = viewComponent;\n }\n\n /**\n * The name of the `Mediator`.\n *\n * Typically, a `Mediator` will be written to serve\n * one specific control or group controls and so,\n * will not have a need to be dynamically named.
\n *\n * @static\n * @returns {string}\n */\n static get NAME() { return \"Mediator\" }\n}\nexport { Mediator }\n","/*\n * Proxy.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Notifier} from \"../observer/Notifier.js\";\n\n/**\n * A base `Proxy` implementation.\n *\n * In PureMVC, `Proxy` classes are used to manage parts of the\n * application's data model.
\n *\n * A `Proxy` might simply manage a reference to a local data object,\n * in which case interacting with it might involve setting and\n * getting of its data in synchronous fashion.
\n *\n * `Proxy` classes are also used to encapsulate the application's\n * interaction with remote services to save or retrieve data, in which case,\n * we adopt an asynchronous idiom; setting data (or calling a method) on the\n * `Proxy` and listening for a `Notification` to be sent\n * when the `Proxy` has retrieved the data from the service.
\n *\n * @see Model Model\n *\n * @class Proxy\n */\nclass Proxy extends Notifier {\n /**\n * Constructor\n *\n * @constructor\n * @param {string} proxyName\n * @param {Object} [data]\n */\n constructor(proxyName, data = null) {\n super();\n /** @protected\n * @type {string} */\n this._proxyName = proxyName || Proxy.NAME;\n /** @protected\n * @type {Object} */\n this._data = data;\n }\n\n /**\n * Called by the Model when the Proxy is registered\n */\n onRegister() {}\n\n /**\n * Called by the Model when the Proxy is removed\n */\n onRemove() {}\n\n /**\n * Get the proxy name\n *\n * @returns {string}\n */\n get proxyName() {\n return this._proxyName;\n }\n\n /**\n * Get the data object\n *\n * @returns {Object}\n */\n get data () {\n return this._data;\n }\n\n /**\n * Set the data object\n *\n * @param {Object} data\n */\n set data(data) {\n this._data = data;\n }\n\n /**\n *\n * @static\n * @returns {string}\n */\n static get NAME() { return \"Proxy\" }\n}\nexport { Proxy }\n","/*\n * MacroCommand.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {SimpleCommand} from \"./SimpleCommand.js\";\n\n/**\n * A base `Command` implementation that executes other `Command`s.\n *\n * A `MacroCommand` maintains a list of\n * `Command` Class references called SubCommands.
\n *\n * When `execute` is called, the `MacroCommand`\n * instantiates and calls `execute` on each of its SubCommands turn.\n * Each SubCommand will be passed a reference to the original\n * `Notification` that was passed to the `MacroCommand`'s\n * `execute` method.
\n *\n * Unlike `SimpleCommand`, your subclass\n * should not override `execute`, but instead, should\n * override the `initializeMacroCommand` method,\n * calling `addSubCommand` once for each SubCommand\n * to be executed.
\n *\n * @see Controller Controller\n * @see Notification Notification\n * @see SimpleCommand SimpleCommand\n *\n * @class MacroCommand\n */\nclass MacroCommand extends SimpleCommand {\n\n /**\n * Constructor.\n *\n * You should not need to define a constructor,\n * instead, override the `initializeMacroCommand`\n * method.
\n *\n * If your subclass does define a constructor, be\n * sure to call `super()`.
\n *\n * @constructor\n */\n constructor() {\n super();\n /** @protected\n * @type {Array.} */\n this.subCommands = [];\n this.initializeMacroCommand();\n }\n\n /**\n * Initialize the `MacroCommand`.\n *\n * In your subclass, override this method to\n * initialize the `MacroCommand`'s SubCommand\n * list with `Command` class references like\n * this:
\n *\n * `\n *\t\t// Initialize MyMacroCommand\n *\t\tinitializeMacroCommand() {\n *\t\t\tthis.addSubCommand(() => new app.FirstCommand());\n *\t\t\tthis.addSubCommand(() => new app.SecondCommand());\n *\t\t\tthis.addSubCommand(() => new app.ThirdCommand());\n *\t\t}\n * `
\n *\n * Note that SubCommands may be any `Command` implementor,\n * `MacroCommand`s or `SimpleCommands` are both acceptable.\n */\n initializeMacroCommand() {\n\n }\n\n /**\n * Add a SubCommand.\n *\n *
The SubCommands will be called in First In/First Out (FIFO)\n * order.
\n *\n * @param {function():SimpleCommand} factory\n */\n addSubCommand(factory) {\n this.subCommands.push(factory);\n }\n\n /**\n * Execute this `MacroCommand`'s SubCommands.\n *\n * The SubCommands will be called in First In/First Out (FIFO)\n * order.
\n *\n * @param {Notification} notification\n */\n execute(notification) {\n while(this.subCommands.length > 0) {\n let factory = this.subCommands.shift();\n let commandInstance = factory();\n commandInstance.initializeNotifier(this.multitonKey);\n commandInstance.execute(notification);\n }\n }\n\n}\nexport { MacroCommand }\n"],"names":["Observer","constructor","notifyMethod","notifyContext","this","_notifyMethod","_notifyContext","notifyObserver","notification","call","compareNotifyContext","View","key","instanceMap","get","Error","MULTITON_MSG","multitonKey","set","mediatorMap","Map","observerMap","initializeView","getInstance","factory","registerObserver","notificationName","observer","push","Array","notifyObservers","has","name","observers","slice","i","length","removeObserver","splice","delete","registerMediator","mediator","mediatorName","initializeNotifier","interests","listNotificationInterests","handleNotification","bind","onRegister","retrieveMediator","removeMediator","onRemove","hasMediator","removeView","Controller","commandMap","initializeController","view","executeCommand","commandInstance","execute","registerCommand","hasCommand","removeCommand","removeController","Model","proxyMap","initializeModel","registerProxy","proxy","proxyName","retrieveProxy","hasProxy","removeProxy","removeModel","Notification","body","type","_name","_body","_type","toString","str","Facade","initializeFacade","model","controller","sendNotification","hasCore","removeCore","Notifier","facade","SimpleCommand","super","Mediator","viewComponent","_mediatorName","NAME","_viewComponent","Proxy","data","_proxyName","_data","subCommands","initializeMacroCommand","addSubCommand","shift"],"mappings":"aA0BA,MAAMA,EAWF,WAAAC,CAAYC,EAAcC,GACtBC,KAAKC,cAAgBH,EACrBE,KAAKE,eAAiBH,CACzB,CAOD,cAAAI,CAAeC,GACXJ,KAAKC,cAAcI,KAAKL,KAAKE,eAAgBE,EAChD,CAQD,oBAAAE,CAAqBP,GACjB,OAAOC,KAAKE,iBAAmBH,CAClC,CAOD,gBAAID,GACA,OAAOE,KAAKC,aACf,CASD,gBAAIH,CAAaA,GACbE,KAAKC,cAAgBH,CACxB,CAOD,iBAAIC,GACA,OAAOC,KAAKE,cACf,CAOD,iBAAIH,CAAcA,GACdC,KAAKE,eAAiBH,CACzB,EClEL,MAAMQ,EAeF,WAAAV,CAAYW,GACR,GAAiC,MAA7BD,EAAKE,YAAYC,IAAIF,GAAc,MAAM,IAAIG,MAAMJ,EAAKK,cAG5DZ,KAAKa,YAAcL,EACnBD,EAAKE,YAAYK,IAAId,KAAKa,YAAab,MAGvCA,KAAKe,YAAc,IAAIC,IAGvBhB,KAAKiB,YAAc,IAAID,IACvBhB,KAAKkB,gBACR,CAUD,cAAAA,GAEC,CAUD,kBAAOC,CAAYX,EAAKY,GAMpB,OALwB,MAApBb,E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tC,KAAK4F,aACf,CAYD,iBAAID,GACA,OAAO3F,KAAK8F,cACf,CAOD,iBAAIH,CAAcA,GACd3F,KAAK8F,eAAiBH,CACzB,CAYD,eAAWE,GAAS,MAAO,UAAY,EClF3C,MAAME,UAAcT,EAQhB,WAAAzF,CAAYqE,EAAW8B,EAAO,MAC1BP,QAGAzF,KAAKiG,WAAa/B,GAAa6B,EAAMF,KAGrC7F,KAAKkG,MAAQF,CAChB,CAKD,UAAApD,GAAe,CAKf,QAAAG,GAAa,CAOb,aAAImB,GACA,OAAOlE,KAAKiG,UACf,CAOD,QAAID,GACA,OAAOhG,KAAKkG,KACf,CAOD,QAAIF,CAAKA,GACLhG,KAAKkG,MAAQF,CAChB,CAOD,eAAWH,GAAS,MAAO,OAAS,6DCxDxC,cAA2BL,EAcvB,WAAA3F,GACI4F,QAGAzF,KAAKmG,YAAc,GACnBnG,KAAKoG,wBACR,CAsBD,sBAAAA,GAEC,CAUD,aAAAC,CAAcjF,GACVpB,KAAKmG,YAAY3E,KAAKJ,EACzB,CAUD,OAAAoC,CAAQpD,GACJ,KAAMJ,KAAKmG,YAAYnE,OAAS,GAAG,CAC/B,IACIuB,EADUvD,KAAKmG,YAAYG,OACTlF,GACtBmC,EAAgBhB,mBAAmBvC,KAAKa,aACxC0C,EAAgBC,QAAQpD,EAC3B,CACJ"}
\ No newline at end of file
diff --git a/bin/esm/puremvc.js b/bin/esm/index.js
similarity index 98%
rename from bin/esm/puremvc.js
rename to bin/esm/index.js
index 9d4f99e..6e1013c 100644
--- a/bin/esm/puremvc.js
+++ b/bin/esm/index.js
@@ -32,12 +32,12 @@ class Observer {
* The notification method on the interested object should take
* one parameter of type `Notification`
*
- * @param {function(Notification):void} notifyMethod
- * @param {Object} notifyContext
+ * @param {function(Notification):void | null} [notify = null]
+ * @param {Object | null} [context = null]
*/
- constructor(notifyMethod, notifyContext) {
- this._notifyMethod = notifyMethod;
- this._notifyContext = notifyContext;
+ constructor(notify = null, context = null) {
+ this._notifyMethod = notify;
+ this._notifyContext = context;
}
/**
@@ -418,10 +418,10 @@ class Controller {
* passing the unique key for this instance
* `Controller.getInstance( multitonKey )`
*
- * @throws {Error} Error if instance for this Multiton key has already been constructed
- *
* @constructor
* @param {string} key
+ *
+ * @throws {Error} Error if instance for this Multiton key has already been constructed
*/
constructor(key) {
if (Controller.instanceMap[key] != null) throw new Error(Controller.MULTITON_MSG);
@@ -590,7 +590,6 @@ class Controller {
*
* @class Model
*/
-
class Model {
/**
@@ -720,7 +719,6 @@ class Model {
*/
/**
- *
* A base `Notification` implementation.
*
* PureMVC does not rely upon underlying event models such
@@ -778,7 +776,7 @@ class Notification {
/**
* Get the body of the `Notification` instance.
*
- * @returns {Object}
+ * @returns {Object | null}
*/
get body() {
return this._body;
@@ -856,6 +854,7 @@ class Facade {
*
* @constructor
* @param {string} key
+ *
* @throws {Error} Error if instance for this Multiton key has already been constructed
*/
constructor(key) {
@@ -1020,7 +1019,7 @@ class Facade {
}
/**
- * Check if a Proxy is registered
+ * Check if a `Proxy` is registered
*
* @param {string} proxyName
* @returns {boolean} whether a Proxy is currently registered with the given `proxyName`.
@@ -1059,7 +1058,7 @@ class Facade {
}
/**
- * Check if a Mediator is registered or not
+ * Check if a `Mediator` is registered or not
*
* @param {string} mediatorName
* @returns {boolean} whether a Mediator is registered with the given `mediatorName`.
@@ -1099,7 +1098,7 @@ class Facade {
* compatibility, and to allow you to send custom
* notification classes using the facade.
*
- * Usually you should just call sendNotification
+ *
Usually you should just call `sendNotification`
* and pass the parameters, never having to
* construct the notification yourself.
*
@@ -1438,10 +1437,10 @@ class Mediator extends Notifier {
* Constructor.
*
* @constructor
- * @param {string} mediatorName
- * @param {Object} [viewComponent] viewComponent
+ * @param {string | null} [mediatorName=null]
+ * @param {Object | null} [viewComponent=null]
*/
- constructor(mediatorName, viewComponent = null) {
+ constructor(mediatorName = null, viewComponent = null) {
super();
this._mediatorName = mediatorName || Mediator.NAME;
this._viewComponent = viewComponent;
@@ -1502,7 +1501,7 @@ class Mediator extends Notifier {
* be defined in the subclass that casts the view
* object to a type, like this:
*
- * @returns {Object}
+ * @returns {Object | null}
*/
get viewComponent() {
return this._viewComponent;
@@ -1564,16 +1563,16 @@ class Proxy extends Notifier {
* Constructor
*
* @constructor
- * @param {string} proxyName
- * @param {Object} [data]
+ * @param {string | null} [proxyName=null]
+ * @param {Object | null} [data=null]
*/
- constructor(proxyName, data = null) {
+ constructor(proxyName = null, data = null) {
super();
/** @protected
* @type {string} */
this._proxyName = proxyName || Proxy.NAME;
/** @protected
- * @type {Object} */
+ * @type {Object | null} */
this._data = data;
}
@@ -1599,7 +1598,7 @@ class Proxy extends Notifier {
/**
* Get the data object
*
- * @returns {Object}
+ * @returns {Object | null}
*/
get data () {
return this._data;
diff --git a/bin/esm/index.min.js b/bin/esm/index.min.js
new file mode 100644
index 0000000..02b3b0d
--- /dev/null
+++ b/bin/esm/index.min.js
@@ -0,0 +1,2 @@
+class t{constructor(t=null,e=null){this._notifyMethod=t,this._notifyContext=e}notifyObserver(t){this._notifyMethod.call(this._notifyContext,t)}compareNotifyContext(t){return this._notifyContext===t}get notifyMethod(){return this._notifyMethod}set notifyMethod(t){this._notifyMethod=t}get notifyContext(){return this._notifyContext}set notifyContext(t){this._notifyContext=t}}class e{constructor(t){if(null!=e.instanceMap.get(t))throw new Error(e.MULTITON_MSG);this.multitonKey=t,e.instanceMap.set(this.multitonKey,this),this.mediatorMap=new Map,this.observerMap=new Map,this.initializeView()}initializeView(){}static getInstance(t,i){return null==e.instanceMap&&(e.instanceMap=new Map),null==e.instanceMap.get(t)&&e.instanceMap.set(t,i(t)),e.instanceMap.get(t)}registerObserver(t,e){if(null!=this.observerMap.get(t)){this.observerMap.get(t).push(e)}else this.observerMap.set(t,new Array(e))}notifyObservers(t){if(this.observerMap.has(t.name)){let e=this.observerMap.get(t.name).slice();for(let i=0;i0){let n=new t(e.handleNotification.bind(e),e);for(let t=0;tnew e(t)))}static getInstance(t,e){return null==i.instanceMap&&(i.instanceMap=new Map),null==i.instanceMap.get(t)&&i.instanceMap.set(t,e(t)),i.instanceMap.get(t)}executeCommand(t){let e=this.commandMap.get(t.name);if(null==e)return;let i=e();i.initializeNotifier(this.multitonKey),i.execute(t)}registerCommand(e,i){null==this.commandMap.get(e)&&this.view.registerObserver(e,new t(this.executeCommand,this)),this.commandMap.set(e,i)}hasCommand(t){return this.commandMap.has(t)}removeCommand(t){this.hasCommand(t)&&(this.view.removeObserver(t,this),this.commandMap.delete(t))}static removeController(t){i.instanceMap.delete(t)}static get MULTITON_MSG(){return"Controller instance for this Multiton key already constructed!"}}class n{constructor(t){if(null!=n.instanceMap.get(t))throw new Error(n.MULTITON_MSG);this.multitonKey=t,n.instanceMap.set(this.multitonKey,this),this.proxyMap=new Map,this.initializeModel()}initializeModel(){}static getInstance(t,e){return null==n.instanceMap&&(n.instanceMap=new Map),null==n.instanceMap.get(t)&&n.instanceMap.set(t,e(t)),n.instanceMap.get(t)}registerProxy(t){t.initializeNotifier(this.multitonKey),this.proxyMap.set(t.proxyName,t),t.onRegister()}retrieveProxy(t){return this.proxyMap.get(t)||null}hasProxy(t){return this.proxyMap.has(t)}removeProxy(t){let e=this.proxyMap.get(t);return null!=e&&(this.proxyMap.delete(t),e.onRemove()),e}static removeModel(t){n.instanceMap.delete(t)}static get MULTITON_MSG(){return"Model instance for this Multiton key already constructed!"}}class s{constructor(t,e=null,i=""){this._name=t,this._body=e,this._type=i}get name(){return this._name}get body(){return this._body}set body(t){this._body=t}get type(){return this._type}set type(t){this._type=t}toString(){let t="Notification Name: "+this.name;return t+="\nBody:"+(null==this.body?"null":this.body.toString()),t+="\nType:"+(null==this.type?"null":this.type),t}}class r{constructor(t){if(null!=r.instanceMap[t])throw new Error(r.MULTITON_MSG);this.initializeNotifier(t),r.instanceMap.set(this.multitonKey,this),this.initializeFacade()}initializeFacade(){this.initializeModel(),this.initializeController(),this.initializeView()}static getInstance(t,e){return null==r.instanceMap&&(r.instanceMap=new Map),null==r.instanceMap.get(t)&&r.instanceMap.set(t,e(t)),r.instanceMap.get(t)}initializeModel(){null==this.model&&(this.model=n.getInstance(this.multitonKey,(t=>new n(t))))}initializeController(){null==this.controller&&(this.controller=i.getInstance(this.multitonKey,(t=>new i(t))))}initializeView(){null==this.view&&(this.view=e.getInstance(this.multitonKey,(t=>new e(t))))}registerCommand(t,e){this.controller.registerCommand(t,e)}hasCommand(t){return this.controller.hasCommand(t)}removeCommand(t){this.controller.removeCommand(t)}registerProxy(t){this.model.registerProxy(t)}removeProxy(t){return this.model.removeProxy(t)}hasProxy(t){return this.model.hasProxy(t)}retrieveProxy(t){return this.model.retrieveProxy(t)}registerMediator(t){this.view.registerMediator(t)}removeMediator(t){return this.view.removeMediator(t)}hasMediator(t){return this.view.hasMediator(t)}retrieveMediator(t){return this.view.retrieveMediator(t)}sendNotification(t,e=null,i=""){this.notifyObservers(new s(t,e,i))}notifyObservers(t){this.view.notifyObservers(t)}initializeNotifier(t){this.multitonKey=t}static hasCore(t){return this.instanceMap.has(t)}static removeCore(t){null!=r.instanceMap.get(t)&&(n.removeModel(t),e.removeView(t),i.removeController(t),this.instanceMap.delete(t))}static get MULTITON_MSG(){return"Facade instance for this Multiton key already constructed!"}}class o{constructor(){}sendNotification(t,e=null,i=""){null!=this.facade&&this.facade.sendNotification(t,e,i)}initializeNotifier(t){this.multitonKey=t}get facade(){if(null==this.multitonKey)throw new Error(o.MULTITON_MSG);return r.getInstance(this.multitonKey,(t=>new r(t)))}static get MULTITON_MSG(){return"multitonKey for this Notifier not yet initialized!"}}class a extends o{constructor(){super()}execute(t){}}class l extends a{constructor(){super(),this.subCommands=[],this.initializeMacroCommand()}initializeMacroCommand(){}addSubCommand(t){this.subCommands.push(t)}execute(t){for(;this.subCommands.length>0;){let e=this.subCommands.shift()();e.initializeNotifier(this.multitonKey),e.execute(t)}}}class h extends o{constructor(t=null,e=null){super(),this._mediatorName=t||h.NAME,this._viewComponent=e}onRegister(){}onRemove(){}listNotificationInterests(){return[]}handleNotification(t){}get mediatorName(){return this._mediatorName}get viewComponent(){return this._viewComponent}set viewComponent(t){this._viewComponent=t}static get NAME(){return"Mediator"}}class c extends o{constructor(t=null,e=null){super(),this._proxyName=t||c.NAME,this._data=e}onRegister(){}onRemove(){}get proxyName(){return this._proxyName}get data(){return this._data}set data(t){this._data=t}static get NAME(){return"Proxy"}}export{i as Controller,r as Facade,l as MacroCommand,h as Mediator,n as Model,s as Notification,o as Notifier,t as Observer,c as Proxy,a as SimpleCommand,e as View};
+//# sourceMappingURL=index.min.js.map
diff --git a/bin/esm/index.min.js.map b/bin/esm/index.min.js.map
new file mode 100644
index 0000000..cf6946e
--- /dev/null
+++ b/bin/esm/index.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.min.js","sources":["../../src/patterns/observer/Observer.js","../../src/core/View.js","../../src/core/Controller.js","../../src/core/Model.js","../../src/patterns/observer/Notification.js","../../src/patterns/facade/Facade.js","../../src/patterns/observer/Notifier.js","../../src/patterns/command/SimpleCommand.js","../../src/patterns/command/MacroCommand.js","../../src/patterns/mediator/Mediator.js","../../src/patterns/proxy/Proxy.js"],"sourcesContent":["/*\n * Observer.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\n/**\n * A base `Observer` implementation.\n *\n * An `Observer` is an object that encapsulates information\n * about an interested object with a method that should\n * be called when a particular `Notification` is broadcast.
\n *\n * In PureMVC, the `Observer` class assumes these responsibilities:
\n *\n * \n * - Encapsulate the notification (callback) method of the interested object.
\n * - Encapsulate the notification context (this) of the interested object.
\n * - Provide methods for setting the notification method and context.
\n * - Provide a method for notifying the interested object.
\n *
\n *\n * @class Observer\n */\nclass Observer {\n\n /**\n * Constructor.\n *\n * The notification method on the interested object should take\n * one parameter of type `Notification`
\n *\n * @param {function(Notification):void | null} [notify = null]\n * @param {Object | null} [context = null]\n */\n constructor(notify = null, context = null) {\n this._notifyMethod = notify;\n this._notifyContext = context;\n }\n\n /**\n * Notify the interested object.\n *\n * @param {Notification} notification\n */\n notifyObserver(notification) {\n this._notifyMethod.call(this._notifyContext, notification);\n }\n\n /**\n * Compare an object to the notification context.\n *\n * @param {Object} notifyContext\n * @returns {boolean}\n */\n compareNotifyContext(notifyContext) {\n return this._notifyContext === notifyContext;\n }\n\n /**\n * Get the notification method.\n *\n * @returns {function(Notification):void}\n */\n get notifyMethod() {\n return this._notifyMethod\n }\n\n /**\n * Set the notification method.\n *\n * The notification method should take one parameter of type `Notification`.
\n *\n * @param {function(Notification): void} notifyMethod - The function to be called when a notification is received.\n */\n set notifyMethod(notifyMethod) {\n this._notifyMethod = notifyMethod;\n }\n\n /**\n * Get the notifyContext\n *\n * @returns {Object}\n */\n get notifyContext() {\n return this._notifyContext;\n }\n\n /**\n * Set the notification context.\n *\n * @param {Object} notifyContext\n */\n set notifyContext(notifyContext) {\n this._notifyContext = notifyContext;\n }\n\n}\nexport { Observer }\n","/*\n * View.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Observer} from \"../patterns/observer/Observer.js\";\n\n/**\n * A Multiton `View` implementation.\n *\n * In PureMVC, the `View` class assumes these responsibilities:
\n *\n * \n * - Maintain a cache of `Mediator` instances.
\n * - Provide methods for registering, retrieving, and removing `Mediators`.
\n * - Notifying `Mediators` when they are registered or removed.
\n * - Managing the observer lists for each `Notification` in the application.
\n * - Providing a method for attaching `Observers` to a `Notification`'s observer list.
\n * - Providing a method for broadcasting a `Notification`.
\n * - Notifying the `Observers` of a given `Notification` when it broadcast.
\n *
\n *\n * @see Mediator Mediator\n * @see Observer Observer\n * @see Notification Notification\n *\n * @class View\n */\nclass View {\n\n /**\n * Constructor.\n *\n * This `View` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Multiton\n * Factory method `View.getInstance( multitonKey )`\n *\n * @constructor\n * @param {string} key\n *\n * @throws {Error} Error if instance for this Multiton key has already been constructed\n */\n constructor(key) {\n if (View.instanceMap.get(key) != null) throw new Error(View.MULTITON_MSG);\n /** @protected\n * @type {string} */\n this.multitonKey = key;\n View.instanceMap.set(this.multitonKey, this);\n /** @protected\n * @type {Map} */\n this.mediatorMap = new Map();\n /** @protected\n * @type {Map.>} */\n this.observerMap = new Map();\n this.initializeView();\n }\n\n /**\n * Initialize the Multiton View instance.
\n *\n * Called automatically by the constructor, this\n * is your opportunity to initialize the Multiton\n * instance in your subclass without overriding the\n * constructor.
\n */\n initializeView() {\n\n }\n\n /**\n * View Multiton factory method.\n *\n * @static\n * @param {string} key\n * @param {function(string):View} factory\n * @returns {View} the Multiton instance of `View`\n */\n static getInstance(key, factory) {\n if (View.instanceMap == null)\n /** @static\n * @type {Map} */\n View.instanceMap = new Map();\n if (View.instanceMap.get(key) == null) View.instanceMap.set(key, factory(key));\n return View.instanceMap.get(key);\n }\n\n /**\n * Register an `Observer` to be notified\n * of `Notifications` with a given name.
\n *\n * @param {string} notificationName the name of the `Notifications` to notify this `Observer` of\n * @param {Observer} observer the `Observer` to register\n */\n registerObserver(notificationName, observer) {\n if (this.observerMap.get(notificationName) != null) {\n let observers = this.observerMap.get(notificationName);\n observers.push(observer);\n } else {\n this.observerMap.set(notificationName, new Array(observer));\n }\n }\n\n /**\n * Notify the `Observers` for a particular `Notification`.
\n *\n * All previously attached `Observers` for this `Notification`'s\n * list are notified and are passed a reference to the `Notification` in\n * the order in which they were registered.
\n *\n * @param {Notification} notification the `Notification` to notify `Observers` of.\n */\n notifyObservers(notification) {\n if (this.observerMap.has(notification.name)) {\n // Copy observers from reference array to working array,\n // since the reference array may change during the notification loop\n let observers = this.observerMap.get(notification.name).slice();\n\n // Notify Observers from the working array\n for(let i = 0; i < observers.length; i++) {\n observers[i].notifyObserver(notification);\n }\n }\n }\n\n /**\n * Remove the observer for a given notifyContext from an observer list for a given Notification name.
\n *\n * @param {string} notificationName which observer list to remove from\n * @param {Object} notifyContext remove the observer with this object as its notifyContext\n */\n removeObserver(notificationName, notifyContext) {\n // the observer list for the notification under inspection\n let observers = this.observerMap.get(notificationName);\n\n // find the observer for the notifyContext\n for (let i = 0; i < observers.length; i++) {\n if (observers[i].compareNotifyContext(notifyContext) === true) {\n // there can only be one Observer for a given notifyContext\n // in any given Observer list, so remove it and break\n observers.splice(i, 1);\n break;\n }\n }\n\n // Also, when a Notification's Observer list length falls to\n // zero, delete the notification key from the observer map\n if (observers.length === 0) {\n this.observerMap.delete(notificationName);\n }\n }\n\n /**\n * Register a `Mediator` instance with the `View`.\n *\n * Registers the `Mediator` so that it can be retrieved by name,\n * and further interrogates the `Mediator` for its\n * `Notification` interests.
\n *\n * If the `Mediator` returns any `Notification`\n * names to be notified about, an `Observer` is created encapsulating\n * the `Mediator` instance's `handleNotification` method\n * and registering it as an `Observer` for all `Notifications` the\n * `Mediator` is interested in.
\n *\n * @param {Mediator} mediator a reference to the `Mediator` instance\n */\n registerMediator(mediator) {\n // do not allow re-registration (you must to removeMediator fist)\n if (this.mediatorMap.has(mediator.mediatorName) !== false) return;\n\n mediator.initializeNotifier(this.multitonKey);\n\n // Register the Mediator for retrieval by name\n this.mediatorMap.set(mediator.mediatorName, mediator);\n\n // Get Notification interests, if any.\n let interests = mediator.listNotificationInterests();\n\n // Register Mediator as an observer for each notification of interests\n if (interests.length > 0) {\n // Create Observer referencing this mediator's handleNotification method\n let observer = new Observer(mediator.handleNotification.bind(mediator), mediator); // check bind\n\n // Register Mediator as Observer for its list of Notification interests\n for (let i = 0; i < interests.length; i++) {\n this.registerObserver(interests[i], observer);\n }\n }\n\n // alert the mediator that it has been registered\n mediator.onRegister();\n }\n\n /**\n * Retrieve a `Mediator` from the `View`.\n *\n * @param {string} mediatorName the name of the `Mediator` instance to retrieve.\n * @returns {Mediator} the `Mediator` instance previously registered with the given `mediatorName`.\n */\n retrieveMediator(mediatorName) {\n return this.mediatorMap.get(mediatorName) || null;\n }\n\n /**\n * Remove a `Mediator` from the `View`.\n *\n * @param {string} mediatorName name of the `Mediator` instance to be removed.\n * @returns {Mediator} the `Mediator` that was removed from the `View`\n */\n removeMediator(mediatorName) {\n // Retrieve the named mediator\n let mediator = this.mediatorMap.get(mediatorName);\n\n if (mediator) {\n // for every notification this mediator is interested in...\n let interests = mediator.listNotificationInterests();\n for (let i = 0; i < interests.length; i++) {\n // remove the observer linking the mediator\n // to the notification interest\n this.removeObserver(interests[i], mediator);\n }\n\n // remove the mediator from the map\n this.mediatorMap.delete(mediatorName);\n\n // alert the mediator that it has been removed\n mediator.onRemove();\n }\n\n return mediator;\n }\n\n /**\n * Check if a Mediator is registered or not\n *\n * @param {string} mediatorName\n * @returns {boolean} whether a Mediator is registered with the given `mediatorName`.\n */\n hasMediator(mediatorName) {\n return this.mediatorMap.has(mediatorName);\n }\n\n /**\n * Remove a View instance\n *\n * @static\n * @param key multitonKey of View instance to remove\n */\n static removeView(key) {\n this.instanceMap.delete(key);\n }\n\n /**\n * Message Constants\n *\n * @static\n * @type {string}\n */\n static get MULTITON_MSG() { return \"View instance for this Multiton key already constructed!\" };\n\n}\nexport { View }\n","/*\n * Controller.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {View} from \"./View.js\"\nimport {Observer} from \"../patterns/observer/Observer.js\";\n\n/**\n * A Multiton `Controller` implementation.\n *\n * In PureMVC, the `Controller` class follows the\n * 'Command and Controller' strategy, and assumes these\n * responsibilities:
\n *\n * \n * - Remembering which `Command`s\n * are intended to handle which `Notifications`.
\n * - Registering itself as an `Observer` with\n * the `View` for each `Notification`\n * that it has a `Command` mapping for.
\n * - Creating a new instance of the proper `Command`\n * to handle a given `Notification` when notified by the `View`.
\n * - Calling the `Command`'s `execute`\n * method, passing in the `Notification`.
\n *
\n *\n * Your application must register `Commands` with the\n * Controller.
\n *\n * The simplest way is to subclass `Facade`,\n * and use its `initializeController` method to add your\n * registrations.
\n *\n * @see View View\n * @see Observer Observer\n * @see Notification Notification\n * @see SimpleCommand SimpleCommand\n * @see MacroCommand MacroCommand\n *\n * @class Controller\n */\nclass Controller {\n\n /**\n * Constructor.\n *\n * This `Controller` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Factory method,\n * passing the unique key for this instance\n * `Controller.getInstance( multitonKey )`
\n *\n * @constructor\n * @param {string} key\n *\n * @throws {Error} Error if instance for this Multiton key has already been constructed\n */\n constructor(key) {\n if (Controller.instanceMap[key] != null) throw new Error(Controller.MULTITON_MSG);\n /** @protected\n * @type {string} */\n this.multitonKey = key;\n Controller.instanceMap.set(this.multitonKey, this);\n /** @protected\n * @type {Map} */\n this.commandMap = new Map();\n this.initializeController();\n }\n\n /**\n * Initialize the Multiton `Controller` instance.\n *\n * Called automatically by the constructor.
\n *\n * Note that if you are using a subclass of `View`\n * in your application, you should also subclass `Controller`\n * and override the `initializeController` method in the\n * following way:
\n *\n * `\n *\t\t// ensure that the Controller is talking to my View implementation\n *\t\tinitializeController( )\n *\t\t{\n *\t\t\tthis.view = MyView.getInstance(this.multitonKey, (key) => new MyView(key));\n *\t\t}\n * `
\n *\n */\n initializeController() {\n /** @protected\n * @type {View} **/\n this.view = View.getInstance(this.multitonKey, (key) => new View(key));\n }\n\n /**\n * `Controller` Multiton Factory method.\n *\n * @static\n * @param {string} key\n * @param {function(string):Controller} factory\n * @returns {Controller} the Multiton instance of `Controller`\n */\n static getInstance(key, factory) {\n if (Controller.instanceMap == null)\n /** @static\n @type {Map} */\n Controller.instanceMap = new Map();\n if (Controller.instanceMap.get(key) == null) Controller.instanceMap.set(key, factory(key));\n return Controller.instanceMap.get(key);\n }\n\n /**\n * If a `Command` has previously been registered\n * to handle the given `Notification`, then it is executed.
\n *\n * @param {Notification} notification a `Notification`\n */\n executeCommand(notification) {\n let factory = this.commandMap.get(notification.name);\n if (factory == null) return;\n\n let commandInstance = factory();\n commandInstance.initializeNotifier(this.multitonKey);\n commandInstance.execute(notification);\n }\n\n /**\n * Register a particular `Command` class as the handler\n * for a particular `Notification`.
\n *\n * If an `Command` has already been registered to\n * handle `Notification`s with this name, it is no longer\n * used, the new `Command` is used instead.
\n *\n * The Observer for the new Command is only created if this the\n * first time a Command has been registered for this Notification name.
\n *\n * @param notificationName the name of the `Notification`\n * @param {function():SimpleCommand} factory\n */\n registerCommand(notificationName, factory) {\n if (this.commandMap.get(notificationName) == null) {\n this.view.registerObserver(notificationName, new Observer(this.executeCommand, this));\n }\n this.commandMap.set(notificationName, factory);\n }\n\n /**\n * Check if a Command is registered for a given Notification\n *\n * @param {string} notificationName\n * @return {boolean} whether a Command is currently registered for the given `notificationName`.\n */\n hasCommand(notificationName) {\n return this.commandMap.has(notificationName);\n }\n\n /**\n * Remove a previously registered `Command` to `Notification` mapping.\n *\n * @param {string} notificationName the name of the `Notification` to remove the `Command` mapping for\n */\n removeCommand(notificationName) {\n // if the Command is registered...\n if(this.hasCommand(notificationName)) {\n // remove the observer\n this.view.removeObserver(notificationName, this);\n\n // remove the command\n this.commandMap.delete(notificationName)\n }\n }\n\n /**\n * Remove a Controller instance\n *\n * @static\n * @param {string} key of Controller instance to remove\n */\n static removeController(key) {\n Controller.instanceMap.delete(key);\n }\n\n /**\n * Message Constants\n *\n * @static\n * @type {string}\n */\n static get MULTITON_MSG() { return \"Controller instance for this Multiton key already constructed!\" };\n}\nexport { Controller }\n","/*\n * Model.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\n/**\n * A Multiton `Model` implementation.\n *\n * In PureMVC, the `Model` class provides\n * access to model objects (Proxies) by named lookup.\n *\n *
The `Model` assumes these responsibilities:
\n *\n * \n * - Maintain a cache of `Proxy` instances.
\n * - Provide methods for registering, retrieving, and removing\n * `Proxy` instances.
\n *
\n *\n * Your application must register `Proxy` instances\n * with the `Model`. Typically, you use an\n * `Command` to create and register `Proxy`\n * instances once the `Facade` has initialized the Core\n * actors.
\n *\n * @see Proxy Proxy\n *\n * @class Model\n */\nclass Model {\n\n /**\n * Constructor.\n *\n * This `Model` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Multiton\n * Factory method `Model.getInstance( multitonKey )`\n *\n * @constructor\n * @param {string} key\n *\n * @throws {Error} Error if instance for this Multiton key instance has already been constructed\n */\n constructor(key) {\n if (Model.instanceMap.get(key) != null) throw new Error(Model.MULTITON_MSG);\n /** @protected\n * @type {string} */\n this.multitonKey = key;\n Model.instanceMap.set(this.multitonKey, this);\n /** @protected\n * @type {Map} */\n this.proxyMap = new Map();\n this.initializeModel();\n }\n\n /**\n * Initialize the `Model` instance.\n *\n * Called automatically by the constructor, this\n * is your opportunity to initialize the Multiton\n * instance in your subclass without overriding the\n * constructor.
\n *\n */\n initializeModel() {\n\n }\n\n /**\n * `Model` Multiton Factory method.\n *\n * @static\n * @param {string} key\n * @param {function(string):Model} factory\n * @returns {Model} the instance for this Multiton key\n */\n static getInstance(key, factory) {\n if (Model.instanceMap == null)\n /** @static\n @type {Map} */\n Model.instanceMap = new Map();\n if (Model.instanceMap.get(key) == null) Model.instanceMap.set(key, factory(key));\n return Model.instanceMap.get(key);\n }\n\n /**\n * Register a `Proxy` with the `Model`.\n *\n * @param {Proxy} proxy a `Proxy` to be held by the `Model`.\n */\n registerProxy(proxy) {\n proxy.initializeNotifier(this.multitonKey);\n this.proxyMap.set(proxy.proxyName, proxy);\n proxy.onRegister();\n }\n\n /**\n * Retrieve a `Proxy` from the `Model`.\n *\n * @param {string} proxyName\n * @returns {Proxy} the `Proxy` instance previously registered with the given `proxyName`.\n */\n retrieveProxy(proxyName) {\n return this.proxyMap.get(proxyName) || null;\n }\n\n /**\n * Check if a Proxy is registered\n *\n * @param {string} proxyName\n * @returns {boolean} whether a Proxy is currently registered with the given `proxyName`.\n */\n hasProxy(proxyName) {\n return this.proxyMap.has(proxyName);\n }\n\n /**\n * Remove a `Proxy` from the `Model`.\n *\n * @param {string} proxyName name of the `Proxy` instance to be removed.\n * @returns {Proxy} the `Proxy` that was removed from the `Model`\n */\n removeProxy(proxyName) {\n let proxy = this.proxyMap.get(proxyName);\n if (proxy != null) {\n this.proxyMap.delete(proxyName);\n proxy.onRemove();\n }\n return proxy;\n }\n\n /**\n * Remove a Model instance\n *\n * @static\n * @param key\n */\n static removeModel(key) {\n Model.instanceMap.delete(key);\n }\n\n /**\n * @static\n * @type {string}\n */\n static get MULTITON_MSG() { return \"Model instance for this Multiton key already constructed!\" };\n}\nexport { Model }\n","/*\n * Notification.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\n/**\n * A base `Notification` implementation.\n *\n * PureMVC does not rely upon underlying event models such\n * as the one provided with Flash, and ActionScript 3 does\n * not have an inherent event model.
\n *\n * The Observer Pattern as implemented within PureMVC exists\n * to support event-driven communication between the\n * application and the actors of the MVC triad.
\n *\n * Notifications are not meant to be a replacement for Events\n * in Flex/Flash/Apollo. Generally, `Mediator` implementors\n * place event listeners on their view components, which they\n * then handle in the usual way. This may lead to the broadcast of `Notification`s to\n * trigger `Command`s or to communicate with other `Mediators`. `Proxy` and `Command`\n * instances communicate with each other and `Mediator`s\n * by broadcasting `Notification`s.
\n *\n * A key difference between Flash `Event`s and PureMVC\n * `Notification`s is that `Event`s follow the\n * 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy\n * until some parent component handles the `Event`, while\n * PureMVC `Notification`s follow a 'Publish/Subscribe'\n * pattern. PureMVC classes need not be related to each other in a\n * parent/child relationship in order to communicate with one another\n * using `Notification`s.
\n *\n * @class Notification\n */\nclass Notification {\n\n /**\n * Constructor.\n *\n * @constructor\n * @param {string} name - The name of the notification.\n * @param {Object|null} [body=null] - The body of the notification, defaults to `null`.\n * @param {string} [type=\"\"] - The type of the notification, defaults to an empty string.\n */\n constructor(name, body = null, type = \"\") {\n this._name = name;\n this._body = body;\n this._type = type;\n }\n\n /**\n * Get the name of the `Notification` instance.\n *\n * @returns {string}\n */\n get name() {\n return this._name;\n }\n\n /**\n * Get the body of the `Notification` instance.\n *\n * @returns {Object | null}\n */\n get body() {\n return this._body;\n }\n\n /**\n * Set the body of the `Notification` instance.\n *\n * @param {Object|null} body\n */\n set body(body) {\n this._body = body;\n }\n\n /**\n * Get the type of the `Notification` instance.\n *\n * @returns {string}\n */\n get type() {\n return this._type;\n }\n\n /**\n * Set the type of the `Notification` instance.\n *\n * @param {string} type\n */\n set type(type) {\n this._type = type;\n }\n\n /**\n * Get the string representation of the `Notification` instance.\n *\n * @returns {string}\n */\n toString() {\n let str= \"Notification Name: \" + this.name;\n str+= \"\\nBody:\" + ((this.body == null ) ? \"null\" : this.body.toString());\n str+= \"\\nType:\" + ((this.type == null ) ? \"null\" : this.type);\n return str;\n }\n\n}\nexport { Notification }\n","/*\n * Facade.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Controller} from \"../../core/Controller.js\";\nimport {Model} from \"../../core/Model.js\";\nimport {View} from \"../../core/View.js\";\nimport {Notification} from \"../observer/Notification.js\";\n\n/**\n * A base Multiton `Facade` implementation.\n *\n * @see Model Model\n * @see View View\n * @see Controller Controller\n *\n * @class Facade\n */\nclass Facade {\n\n /**\n * Constructor.\n *\n * This `Facade` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Factory method,\n * passing the unique key for this instance\n * `Facade.getInstance( multitonKey )`
\n *\n * @constructor\n * @param {string} key\n *\n * @throws {Error} Error if instance for this Multiton key has already been constructed\n */\n constructor(key) {\n if (Facade.instanceMap[key] != null) throw new Error(Facade.MULTITON_MSG);\n this.initializeNotifier(key);\n Facade.instanceMap.set(this.multitonKey, this);\n this.initializeFacade();\n }\n\n /**\n * Initialize the Multiton `Facade` instance.\n *\n * Called automatically by the constructor. Override in your\n * subclass to do any subclass specific initializations. Be\n * sure to call `super.initializeFacade()`, though.
\n */\n initializeFacade() {\n this.initializeModel();\n this.initializeController();\n this.initializeView();\n }\n\n /**\n * Facade Multiton Factory method\n *\n * @static\n * @param {string} key\n * @param {function(string):Facade} factory\n * @returns {Facade} the Multiton instance of the Facade\n */\n static getInstance(key, factory) {\n if (Facade.instanceMap == null)\n /** @static\n * @type {Map} */\n Facade.instanceMap = new Map();\n if (Facade.instanceMap.get(key) == null) Facade.instanceMap.set(key, factory(key));\n return Facade.instanceMap.get(key);\n }\n\n /**\n * Initialize the `Model`.\n *\n * Called by the `initializeFacade` method.\n * Override this method in your subclass of `Facade`\n * if one or both of the following are true:
\n *\n * \n * - You wish to initialize a different `Model`.
\n * - You have `Proxy`s to register with the Model that do not\n * retrieve a reference to the Facade at construction time.`
\n *
\n *\n * If you don't want to initialize a different `Model`,\n * call `super.initializeModel()` at the beginning of your\n * method, then register `Proxy`s.\n *\n * Note: This method is rarely overridden; in practice you are more\n * likely to use a `Command` to create and register `Proxy`s\n * with the `Model`, since `Proxy`s with mutable data will likely\n * need to send `Notification`s and thus will likely want to fetch a reference to\n * the `Facade` during their construction.
\n */\n initializeModel() {\n if (this.model != null) return;\n this.model = Model.getInstance(this.multitonKey, key => new Model(key));\n }\n\n /**\n * Initialize the `Controller`.\n *\n * Called by the `initializeFacade` method.\n * Override this method in your subclass of `Facade`\n * if one or both of the following are true:
\n *\n * \n * - You wish to initialize a different `Controller`.
\n * - You have `Commands` to register with the `Controller` at startup.`.
\n *
\n *\n * If you don't want to initialize a different `Controller`,\n * call `super.initializeController()` at the beginning of your\n * method, then register `Command`s.
\n */\n initializeController() {\n if (this.controller != null) return;\n this.controller = Controller.getInstance(this.multitonKey, key => new Controller(key));\n }\n\n /**\n * Initialize the `View`.\n *\n * Called by the `initializeFacade` method.\n * Override this method in your subclass of `Facade`\n * if one or both of the following are true:
\n *\n * \n * - You wish to initialize a different `View`.
\n * - You have `Observers` to register with the `View`
\n *
\n *\n * If you don't want to initialize a different `View`,\n * call `super.initializeView()` at the beginning of your\n * method, then register `Mediator` instances.
\n *\n * Note: This method is rarely overridden; in practice you are more\n * likely to use a `Command` to create and register `Mediator`s\n * with the `View`, since `Mediator` instances will need to send\n * `Notification`s and thus will likely want to fetch a reference\n * to the `Facade` during their construction.
\n */\n initializeView() {\n if (this.view != null) return;\n this.view = View.getInstance(this.multitonKey, key => new View(key));\n }\n\n /**\n * Register a `Command` with the `Controller` by Notification name.\n *\n * @param {string} notificationName the name of the `Notification` to associate the `Command` with\n * @param {function():SimpleCommand} factory a reference to the factory of the `Command`\n */\n registerCommand(notificationName, factory) {\n this.controller.registerCommand(notificationName, factory);\n }\n\n /**\n * Check if a Command is registered for a given Notification\n *\n * @param {string} notificationName\n * @returns {boolean} whether a Command is currently registered for the given `notificationName`.\n */\n hasCommand(notificationName) {\n return this.controller.hasCommand(notificationName);\n }\n\n /**\n * Remove a previously registered `Command` to `Notification` mapping from the Controller.\n *\n * @param {string} notificationName the name of the `Notification` to remove the `Command` mapping for\n */\n removeCommand(notificationName) {\n this.controller.removeCommand(notificationName);\n }\n\n /**\n * Register a `Proxy` with the `Model` by name.\n *\n * @param {Proxy} proxy the `Proxy` instance to be registered with the `Model`.\n */\n registerProxy(proxy) {\n this.model.registerProxy(proxy);\n }\n\n /**\n * Remove a `Proxy` from the `Model` by name.\n *\n * @param {string} proxyName the `Proxy` to remove from the `Model`.\n * @returns {Proxy} the `Proxy` that was removed from the `Model`\n */\n removeProxy(proxyName) {\n return this.model.removeProxy(proxyName);\n }\n\n /**\n * Check if a `Proxy` is registered\n *\n * @param {string} proxyName\n * @returns {boolean} whether a Proxy is currently registered with the given `proxyName`.\n */\n hasProxy(proxyName) {\n return this.model.hasProxy(proxyName);\n }\n\n /**\n * Retrieve a `Proxy` from the `Model` by name.\n *\n * @param {string} proxyName the name of the proxy to be retrieved.\n * @returns {Proxy} the `Proxy` instance previously registered with the given `proxyName`.\n */\n retrieveProxy(proxyName) {\n return this.model.retrieveProxy(proxyName);\n }\n\n /**\n * Register a `Mediator` with the `View`.\n *\n * @param {Mediator} mediator a reference to the `Mediator`\n */\n registerMediator(mediator) {\n this.view.registerMediator(mediator);\n }\n\n /**\n * Remove a `Mediator` from the `View`.\n *\n * @param {string} mediatorName name of the `Mediator` to be removed.\n * @returns {Mediator} the `Mediator` that was removed from the `View`\n */\n removeMediator(mediatorName) {\n return this.view.removeMediator(mediatorName);\n }\n\n /**\n * Check if a `Mediator` is registered or not\n *\n * @param {string} mediatorName\n * @returns {boolean} whether a Mediator is registered with the given `mediatorName`.\n */\n hasMediator(mediatorName) {\n return this.view.hasMediator(mediatorName);\n }\n\n /**\n * Retrieve a `Mediator` from the `View`.\n *\n * @param {string} mediatorName\n * @returns {Mediator} the `Mediator` previously registered with the given `mediatorName`.\n */\n retrieveMediator(mediatorName) {\n return this.view.retrieveMediator(mediatorName);\n }\n\n /**\n * Create and send an `Notification`.\n *\n * Keeps us from having to construct new notification\n * instances in our implementation code.
\n *\n * @param {string} notificationName the name of the notification to send\n * @param {Object} [body] body the body of the notification (optional)\n * @param {string} [type] type the type of the notification (optional)\n */\n sendNotification(notificationName, body = null, type = \"\") {\n this.notifyObservers(new Notification(notificationName, body, type));\n }\n\n /**\n * Notify `Observer`s.\n *\n * This method is left public mostly for backward\n * compatibility, and to allow you to send custom\n * notification classes using the facade.
\n *\n * Usually you should just call `sendNotification`\n * and pass the parameters, never having to\n * construct the notification yourself.
\n *\n * @param {Notification} notification the `Notification` to have the `View` notify `Observers` of.\n */\n notifyObservers(notification) {\n this.view.notifyObservers(notification);\n }\n\n /**\n * Set the Multiton key for this facade instance.\n *\n * Not called directly, but instead from the\n * constructor when getInstance is invoked.\n * It is necessary to be public in order to\n * implement Notifier.
\n */\n initializeNotifier(key) {\n this.multitonKey = key;\n }\n\n /**\n * Check if a Core is registered or not\n *\n * @static\n * @param {string} key the multiton key for the Core in question\n * @returns {boolean} whether a Core is registered with the given `key`.\n */\n static hasCore(key) {\n return this.instanceMap.has(key);\n }\n\n /**\n * Remove a Core.\n *\n * Remove the Model, View, Controller and Facade\n * instances for the given key.
\n *\n * @static\n * @param {string} key multitonKey of the Core to remove\n */\n static removeCore(key) {\n if (Facade.instanceMap.get(key) == null) return;\n Model.removeModel(key);\n View.removeView(key);\n Controller.removeController(key);\n this.instanceMap.delete(key);\n }\n\n /**\n * Message Constants\n *\n * @static\n * @returns {string}\n */\n static get MULTITON_MSG() {return \"Facade instance for this Multiton key already constructed!\"};\n}\nexport { Facade }\n","/*\n * Notifier.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Facade} from \"../facade/Facade.js\";\n\n/**\n * A Base `Notifier` implementation.\n *\n * `MacroCommand, Command, Mediator` and `Proxy`\n * all have a need to send `Notifications`.
\n *\n *
The `Notifier` interface provides a common method called\n * `sendNotification` that relieves implementation code of\n * the necessity to actually construct `Notifications`.
\n *\n * The `Notifier` class, which all the above-mentioned classes\n * extend, provides an initialized reference to the `Facade`\n * Multiton, which is required for the convenience method\n * for sending `Notifications`, but also eases implementation as these\n * classes have frequent `Facade` interactions and usually require\n * access to the facade anyway.
\n *\n * NOTE: In the MultiCore version of the framework, there is one caveat to\n * notifiers, they cannot send notifications or reach the facade until they\n * have a valid multitonKey.
\n *\n * The multitonKey is set:\n * * on a Command when it is executed by the Controller\n * * on a Mediator is registered with the View\n * * on a Proxy is registered with the Model.\n *\n * @see Proxy Proxy\n * @see Facade Facade\n * @see Mediator Mediator\n * @see MacroCommand MacroCommand\n * @see SimpleCommand SimpleCommand\n *\n * @class Notifier\n */\nclass Notifier {\n\n constructor() {}\n\n /**\n * Create and send an `Notification`.\n *\n * Keeps us from having to construct new Notification\n * instances in our implementation code.
\n *\n * @param {string} notificationName\n * @param {Object} [body] body\n * @param {string} [type] type\n */\n sendNotification (notificationName, body = null, type = \"\") {\n if (this.facade != null) {\n this.facade.sendNotification(notificationName, body, type);\n }\n }\n\n /**\n * Initialize this Notifier instance.\n *\n * This is how a Notifier gets its multitonKey.\n * Calls to sendNotification or to access the\n * facade will fail until after this method\n * has been called.
\n *\n * Mediators, Commands or Proxies may override\n * this method in order to send notifications\n * or access the Multiton Facade instance as\n * soon as possible. They CANNOT access the facade\n * in their constructors, since this method will not\n * yet have been called.
\n *\n * @param {string} key the multitonKey for this Notifier to use\n */\n initializeNotifier(key) {\n this.multitonKey = key;\n }\n\n /**\n * Return the Multiton Facade instance\n *\n * @typedef {Facade} Facade\n *\n * @throws {Error}\n */\n get facade() {\n if (this.multitonKey == null) throw new Error(Notifier.MULTITON_MSG);\n return Facade.getInstance(this.multitonKey, key => new Facade(key));\n }\n\n /**\n * Message Constants\n *\n * @static\n * @returns {string}\n */\n static get MULTITON_MSG() { return \"multitonKey for this Notifier not yet initialized!\" }\n}\nexport { Notifier }\n","/*\n * SimpleCommand.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Notifier} from \"../observer/Notifier.js\";\n\n/**\n * A base `Command` implementation.\n *\n * Your subclass should override the `execute`\n * method where your business logic will handle the `Notification`.
\n *\n * @see Controller Controller\n * @see Notification Notification\n * @see MacroCommand MacroCommand\n *\n * @class SimpleCommand\n */\nclass SimpleCommand extends Notifier {\n\n constructor() {\n super();\n }\n\n /**\n * Fulfill the use-case initiated by the given `Notification`.\n *\n * In the Command Pattern, an application use-case typically\n * begins with some user action, which results in a `Notification` being broadcast, which\n * is handled by business logic in the `execute` method of an\n * `Command`.
\n *\n * @param {Notification} notification\n */\n execute(notification) {\n\n }\n\n}\nexport { SimpleCommand }\n","/*\n * MacroCommand.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {SimpleCommand} from \"./SimpleCommand.js\";\n\n/**\n * A base `Command` implementation that executes other `Command`s.\n *\n * A `MacroCommand` maintains a list of\n * `Command` Class references called SubCommands.
\n *\n * When `execute` is called, the `MacroCommand`\n * instantiates and calls `execute` on each of its SubCommands turn.\n * Each SubCommand will be passed a reference to the original\n * `Notification` that was passed to the `MacroCommand`'s\n * `execute` method.
\n *\n * Unlike `SimpleCommand`, your subclass\n * should not override `execute`, but instead, should\n * override the `initializeMacroCommand` method,\n * calling `addSubCommand` once for each SubCommand\n * to be executed.
\n *\n * @see Controller Controller\n * @see Notification Notification\n * @see SimpleCommand SimpleCommand\n *\n * @class MacroCommand\n */\nclass MacroCommand extends SimpleCommand {\n\n /**\n * Constructor.\n *\n * You should not need to define a constructor,\n * instead, override the `initializeMacroCommand`\n * method.
\n *\n * If your subclass does define a constructor, be\n * sure to call `super()`.
\n *\n * @constructor\n */\n constructor() {\n super();\n /** @protected\n * @type {Array.} */\n this.subCommands = [];\n this.initializeMacroCommand();\n }\n\n /**\n * Initialize the `MacroCommand`.\n *\n * In your subclass, override this method to\n * initialize the `MacroCommand`'s SubCommand\n * list with `Command` class references like\n * this:
\n *\n * `\n *\t\t// Initialize MyMacroCommand\n *\t\tinitializeMacroCommand() {\n *\t\t\tthis.addSubCommand(() => new app.FirstCommand());\n *\t\t\tthis.addSubCommand(() => new app.SecondCommand());\n *\t\t\tthis.addSubCommand(() => new app.ThirdCommand());\n *\t\t}\n * `
\n *\n * Note that SubCommands may be any `Command` implementor,\n * `MacroCommand`s or `SimpleCommands` are both acceptable.\n */\n initializeMacroCommand() {\n\n }\n\n /**\n * Add a SubCommand.\n *\n *
The SubCommands will be called in First In/First Out (FIFO)\n * order.
\n *\n * @param {function():SimpleCommand} factory\n */\n addSubCommand(factory) {\n this.subCommands.push(factory);\n }\n\n /**\n * Execute this `MacroCommand`'s SubCommands.\n *\n * The SubCommands will be called in First In/First Out (FIFO)\n * order.
\n *\n * @param {Notification} notification\n */\n execute(notification) {\n while(this.subCommands.length > 0) {\n let factory = this.subCommands.shift();\n let commandInstance = factory();\n commandInstance.initializeNotifier(this.multitonKey);\n commandInstance.execute(notification);\n }\n }\n\n}\nexport { MacroCommand }\n","/*\n * Mediator.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Notifier} from \"../observer/Notifier.js\";\n\n/**\n * A base `Mediator` implementation.\n *\n * @see View View\n *\n * @class Mediator\n */\nclass Mediator extends Notifier {\n\n /**\n * Constructor.\n *\n * @constructor\n * @param {string | null} [mediatorName=null]\n * @param {Object | null} [viewComponent=null]\n */\n constructor(mediatorName = null, viewComponent = null) {\n super();\n this._mediatorName = mediatorName || Mediator.NAME;\n this._viewComponent = viewComponent;\n }\n\n /**\n * Called by the View when the Mediator is registered\n */\n onRegister() {\n\n }\n\n /**\n * Called by the View when the Mediator is removed\n */\n onRemove() {\n\n }\n\n /**\n * List the `Notification` names this\n * `Mediator` is interested in being notified of.\n *\n * @returns {string[]}\n */\n listNotificationInterests() {\n return [];\n }\n\n /**\n * Handle `Notification`s.\n *\n * \n * Typically this will be handled in a switch statement,\n * with one 'case' entry per `Notification`\n * the `Mediator` is interested in.\n *\n * @param {Notification} notification\n */\n handleNotification(notification) {\n\n }\n\n /**\n * the mediator name\n *\n * @returns {string}\n */\n get mediatorName() {\n return this._mediatorName;\n }\n\n /**\n * Get the `Mediator`'s view component.\n *\n *
\n * Additionally, an implicit getter will usually\n * be defined in the subclass that casts the view\n * object to a type, like this:
\n *\n * @returns {Object | null}\n */\n get viewComponent() {\n return this._viewComponent;\n }\n\n /**\n * Set the `Mediator`'s view component.\n *\n * @param {Object} viewComponent\n */\n set viewComponent(viewComponent) {\n this._viewComponent = viewComponent;\n }\n\n /**\n * The name of the `Mediator`.\n *\n * Typically, a `Mediator` will be written to serve\n * one specific control or group controls and so,\n * will not have a need to be dynamically named.
\n *\n * @static\n * @returns {string}\n */\n static get NAME() { return \"Mediator\" }\n}\nexport { Mediator }\n","/*\n * Proxy.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Notifier} from \"../observer/Notifier.js\";\n\n/**\n * A base `Proxy` implementation.\n *\n * In PureMVC, `Proxy` classes are used to manage parts of the\n * application's data model.
\n *\n * A `Proxy` might simply manage a reference to a local data object,\n * in which case interacting with it might involve setting and\n * getting of its data in synchronous fashion.
\n *\n * `Proxy` classes are also used to encapsulate the application's\n * interaction with remote services to save or retrieve data, in which case,\n * we adopt an asynchronous idiom; setting data (or calling a method) on the\n * `Proxy` and listening for a `Notification` to be sent\n * when the `Proxy` has retrieved the data from the service.
\n *\n * @see Model Model\n *\n * @class Proxy\n */\nclass Proxy extends Notifier {\n /**\n * Constructor\n *\n * @constructor\n * @param {string | null} [proxyName=null]\n * @param {Object | null} [data=null]\n */\n constructor(proxyName = null, data = null) {\n super();\n /** @protected\n * @type {string} */\n this._proxyName = proxyName || Proxy.NAME;\n /** @protected\n * @type {Object | null} */\n this._data = data;\n }\n\n /**\n * Called by the Model when the Proxy is registered\n */\n onRegister() {}\n\n /**\n * Called by the Model when the Proxy is removed\n */\n onRemove() {}\n\n /**\n * Get the proxy name\n *\n * @returns {string}\n */\n get proxyName() {\n return this._proxyName;\n }\n\n /**\n * Get the data object\n *\n * @returns {Object | null}\n */\n get data () {\n return this._data;\n }\n\n /**\n * Set the data object\n *\n * @param {Object} data\n */\n set data(data) {\n this._data = data;\n }\n\n /**\n *\n * @static\n * @returns {string}\n */\n static get NAME() { return \"Proxy\" }\n}\nexport { Proxy }\n"],"names":["Observer","constructor","notify","context","this","_notifyMethod","_notifyContext","notifyObserver","notification","call","compareNotifyContext","notifyContext","notifyMethod","View","key","instanceMap","get","Error","MULTITON_MSG","multitonKey","set","mediatorMap","Map","observerMap","initializeView","getInstance","factory","registerObserver","notificationName","observer","push","Array","notifyObservers","has","name","observers","slice","i","length","removeObserver","splice","delete","registerMediator","mediator","mediatorName","initializeNotifier","interests","listNotificationInterests","handleNotification","bind","onRegister","retrieveMediator","removeMediator","onRemove","hasMediator","removeView","Controller","commandMap","initializeController","view","executeCommand","commandInstance","execute","registerCommand","hasCommand","removeCommand","removeController","Model","proxyMap","initializeModel","registerProxy","proxy","proxyName","retrieveProxy","hasProxy","removeProxy","removeModel","Notification","body","type","_name","_body","_type","toString","str","Facade","initializeFacade","model","controller","sendNotification","hasCore","removeCore","Notifier","facade","SimpleCommand","super","MacroCommand","subCommands","initializeMacroCommand","addSubCommand","shift","Mediator","viewComponent","_mediatorName","NAME","_viewComponent","Proxy","data","_proxyName","_data"],"mappings":"AA0BA,MAAMA,EAWF,WAAAC,CAAYC,EAAS,KAAMC,EAAU,MACjCC,KAAKC,cAAgBH,EACrBE,KAAKE,eAAiBH,CACzB,CAOD,cAAAI,CAAeC,GACXJ,KAAKC,cAAcI,KAAKL,KAAKE,eAAgBE,EAChD,CAQD,oBAAAE,CAAqBC,GACjB,OAAOP,KAAKE,iBAAmBK,CAClC,CAOD,gBAAIC,GACA,OAAOR,KAAKC,aACf,CASD,gBAAIO,CAAaA,GACbR,KAAKC,cAAgBO,CACxB,CAOD,iBAAID,GACA,OAAOP,KAAKE,cACf,CAOD,iBAAIK,CAAcA,GACdP,KAAKE,eAAiBK,CACzB,EClEL,MAAME,EAeF,WAAAZ,CAAYa,GACR,GAAiC,MAA7BD,EAAKE,YAAYC,IAAIF,GAAc,MAAM,IAAIG,MAAMJ,EAAKK,cAG5Dd,KAAKe,YAAcL,EACnBD,EAAKE,YAAYK,IAAIhB,KAAKe,YAAaf,MAGvCA,KAAKiB,YAAc,IAAIC,IAGvBlB,KAAKmB,YAAc,IAAID,IACvBlB,KAAKoB,gBACR,CAUD,cAAAA,GAEC,CAUD,kBAAOC,CAAYX,EAAKY,GAMpB,OALwB,MAApBb,EAAKE,cAGLF,EAAKE,YAAc,IAAIO,KACM,MAA7BT,EAAKE,YAAYC,IAAIF,IAAcD,EAAKE,YAAYK,IAAIN,EAAKY,EAAQZ,IAClED,EAAKE,YAAYC,IAAIF,EAC/B,CASD,gBAAAa,CAAiBC,EAAkBC,GAC/B,GAA8C,MAA1CzB,KAAKmB,YAAYP,IAAIY,GAA2B,CAChCxB,KAAKmB,YAAYP,IAAIY,GAC3BE,KAAKD,EAC3B,MACYzB,KAAKmB,YAAYH,IAAIQ,EAAkB,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AAO,EACV,CAYD,kBAAAC,CAAmBxC,GAElB,CAOD,gBAAIoC,GACA,OAAOxC,KAAKmG,aACf,CAYD,iBAAID,GACA,OAAOlG,KAAKqG,cACf,CAOD,iBAAIH,CAAcA,GACdlG,KAAKqG,eAAiBH,CACzB,CAYD,eAAWE,GAAS,MAAO,UAAY,EClF3C,MAAME,UAAcd,EAQhB,WAAA3F,CAAYuE,EAAY,KAAMmC,EAAO,MACjCZ,QAGA3F,KAAKwG,WAAapC,GAAakC,EAAMF,KAGrCpG,KAAKyG,MAAQF,CAChB,CAKD,UAAAzD,GAAe,CAKf,QAAAG,GAAa,CAOb,aAAImB,GACA,OAAOpE,KAAKwG,UACf,CAOD,QAAID,GACA,OAAOvG,KAAKyG,KACf,CAOD,QAAIF,CAAKA,GACLvG,KAAKyG,MAAQF,CAChB,CAOD,eAAWH,GAAS,MAAO,OAAS"}
\ No newline at end of file
diff --git a/bin/esm/puremvc.min.js b/bin/esm/puremvc.min.js
deleted file mode 100644
index e7cd717..0000000
--- a/bin/esm/puremvc.min.js
+++ /dev/null
@@ -1,2 +0,0 @@
-class t{constructor(t,e){this._notifyMethod=t,this._notifyContext=e}notifyObserver(t){this._notifyMethod.call(this._notifyContext,t)}compareNotifyContext(t){return this._notifyContext===t}get notifyMethod(){return this._notifyMethod}set notifyMethod(t){this._notifyMethod=t}get notifyContext(){return this._notifyContext}set notifyContext(t){this._notifyContext=t}}class e{constructor(t){if(null!=e.instanceMap.get(t))throw new Error(e.MULTITON_MSG);this.multitonKey=t,e.instanceMap.set(this.multitonKey,this),this.mediatorMap=new Map,this.observerMap=new Map,this.initializeView()}initializeView(){}static getInstance(t,i){return null==e.instanceMap&&(e.instanceMap=new Map),null==e.instanceMap.get(t)&&e.instanceMap.set(t,i(t)),e.instanceMap.get(t)}registerObserver(t,e){if(null!=this.observerMap.get(t)){this.observerMap.get(t).push(e)}else this.observerMap.set(t,new Array(e))}notifyObservers(t){if(this.observerMap.has(t.name)){let e=this.observerMap.get(t.name).slice();for(let i=0;i0){let n=new t(e.handleNotification.bind(e),e);for(let t=0;tnew e(t)))}static getInstance(t,e){return null==i.instanceMap&&(i.instanceMap=new Map),null==i.instanceMap.get(t)&&i.instanceMap.set(t,e(t)),i.instanceMap.get(t)}executeCommand(t){let e=this.commandMap.get(t.name);if(null==e)return;let i=e();i.initializeNotifier(this.multitonKey),i.execute(t)}registerCommand(e,i){null==this.commandMap.get(e)&&this.view.registerObserver(e,new t(this.executeCommand,this)),this.commandMap.set(e,i)}hasCommand(t){return this.commandMap.has(t)}removeCommand(t){this.hasCommand(t)&&(this.view.removeObserver(t,this),this.commandMap.delete(t))}static removeController(t){i.instanceMap.delete(t)}static get MULTITON_MSG(){return"Controller instance for this Multiton key already constructed!"}}class n{constructor(t){if(null!=n.instanceMap.get(t))throw new Error(n.MULTITON_MSG);this.multitonKey=t,n.instanceMap.set(this.multitonKey,this),this.proxyMap=new Map,this.initializeModel()}initializeModel(){}static getInstance(t,e){return null==n.instanceMap&&(n.instanceMap=new Map),null==n.instanceMap.get(t)&&n.instanceMap.set(t,e(t)),n.instanceMap.get(t)}registerProxy(t){t.initializeNotifier(this.multitonKey),this.proxyMap.set(t.proxyName,t),t.onRegister()}retrieveProxy(t){return this.proxyMap.get(t)||null}hasProxy(t){return this.proxyMap.has(t)}removeProxy(t){let e=this.proxyMap.get(t);return null!=e&&(this.proxyMap.delete(t),e.onRemove()),e}static removeModel(t){n.instanceMap.delete(t)}static get MULTITON_MSG(){return"Model instance for this Multiton key already constructed!"}}class s{constructor(t,e=null,i=""){this._name=t,this._body=e,this._type=i}get name(){return this._name}get body(){return this._body}set body(t){this._body=t}get type(){return this._type}set type(t){this._type=t}toString(){let t="Notification Name: "+this.name;return t+="\nBody:"+(null==this.body?"null":this.body.toString()),t+="\nType:"+(null==this.type?"null":this.type),t}}class r{constructor(t){if(null!=r.instanceMap[t])throw new Error(r.MULTITON_MSG);this.initializeNotifier(t),r.instanceMap.set(this.multitonKey,this),this.initializeFacade()}initializeFacade(){this.initializeModel(),this.initializeController(),this.initializeView()}static getInstance(t,e){return null==r.instanceMap&&(r.instanceMap=new Map),null==r.instanceMap.get(t)&&r.instanceMap.set(t,e(t)),r.instanceMap.get(t)}initializeModel(){null==this.model&&(this.model=n.getInstance(this.multitonKey,(t=>new n(t))))}initializeController(){null==this.controller&&(this.controller=i.getInstance(this.multitonKey,(t=>new i(t))))}initializeView(){null==this.view&&(this.view=e.getInstance(this.multitonKey,(t=>new e(t))))}registerCommand(t,e){this.controller.registerCommand(t,e)}hasCommand(t){return this.controller.hasCommand(t)}removeCommand(t){this.controller.removeCommand(t)}registerProxy(t){this.model.registerProxy(t)}removeProxy(t){return this.model.removeProxy(t)}hasProxy(t){return this.model.hasProxy(t)}retrieveProxy(t){return this.model.retrieveProxy(t)}registerMediator(t){this.view.registerMediator(t)}removeMediator(t){return this.view.removeMediator(t)}hasMediator(t){return this.view.hasMediator(t)}retrieveMediator(t){return this.view.retrieveMediator(t)}sendNotification(t,e=null,i=""){this.notifyObservers(new s(t,e,i))}notifyObservers(t){this.view.notifyObservers(t)}initializeNotifier(t){this.multitonKey=t}static hasCore(t){return this.instanceMap.has(t)}static removeCore(t){null!=r.instanceMap.get(t)&&(n.removeModel(t),e.removeView(t),i.removeController(t),this.instanceMap.delete(t))}static get MULTITON_MSG(){return"Facade instance for this Multiton key already constructed!"}}class o{constructor(){}sendNotification(t,e=null,i=""){null!=this.facade&&this.facade.sendNotification(t,e,i)}initializeNotifier(t){this.multitonKey=t}get facade(){if(null==this.multitonKey)throw new Error(o.MULTITON_MSG);return r.getInstance(this.multitonKey,(t=>new r(t)))}static get MULTITON_MSG(){return"multitonKey for this Notifier not yet initialized!"}}class a extends o{constructor(){super()}execute(t){}}class l extends a{constructor(){super(),this.subCommands=[],this.initializeMacroCommand()}initializeMacroCommand(){}addSubCommand(t){this.subCommands.push(t)}execute(t){for(;this.subCommands.length>0;){let e=this.subCommands.shift()();e.initializeNotifier(this.multitonKey),e.execute(t)}}}class h extends o{constructor(t,e=null){super(),this._mediatorName=t||h.NAME,this._viewComponent=e}onRegister(){}onRemove(){}listNotificationInterests(){return[]}handleNotification(t){}get mediatorName(){return this._mediatorName}get viewComponent(){return this._viewComponent}set viewComponent(t){this._viewComponent=t}static get NAME(){return"Mediator"}}class c extends o{constructor(t,e=null){super(),this._proxyName=t||c.NAME,this._data=e}onRegister(){}onRemove(){}get proxyName(){return this._proxyName}get data(){return this._data}set data(t){this._data=t}static get NAME(){return"Proxy"}}export{i as Controller,r as Facade,l as MacroCommand,h as Mediator,n as Model,s as Notification,o as Notifier,t as Observer,c as Proxy,a as SimpleCommand,e as View};
-//# sourceMappingURL=puremvc.min.js.map
diff --git a/bin/esm/puremvc.min.js.map b/bin/esm/puremvc.min.js.map
deleted file mode 100644
index 4a92559..0000000
--- a/bin/esm/puremvc.min.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"puremvc.min.js","sources":["../../src/patterns/observer/Observer.js","../../src/core/View.js","../../src/core/Controller.js","../../src/core/Model.js","../../src/patterns/observer/Notification.js","../../src/patterns/facade/Facade.js","../../src/patterns/observer/Notifier.js","../../src/patterns/command/SimpleCommand.js","../../src/patterns/command/MacroCommand.js","../../src/patterns/mediator/Mediator.js","../../src/patterns/proxy/Proxy.js"],"sourcesContent":["/*\n * Observer.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\n/**\n * A base `Observer` implementation.\n *\n * An `Observer` is an object that encapsulates information\n * about an interested object with a method that should\n * be called when a particular `Notification` is broadcast.
\n *\n * In PureMVC, the `Observer` class assumes these responsibilities:
\n *\n * \n * - Encapsulate the notification (callback) method of the interested object.
\n * - Encapsulate the notification context (this) of the interested object.
\n * - Provide methods for setting the notification method and context.
\n * - Provide a method for notifying the interested object.
\n *
\n *\n * @class Observer\n */\nclass Observer {\n\n /**\n * Constructor.\n *\n * The notification method on the interested object should take\n * one parameter of type `Notification`
\n *\n * @param {function(Notification):void} notifyMethod\n * @param {Object} notifyContext\n */\n constructor(notifyMethod, notifyContext) {\n this._notifyMethod = notifyMethod;\n this._notifyContext = notifyContext;\n }\n\n /**\n * Notify the interested object.\n *\n * @param {Notification} notification\n */\n notifyObserver(notification) {\n this._notifyMethod.call(this._notifyContext, notification);\n }\n\n /**\n * Compare an object to the notification context.\n *\n * @param {Object} notifyContext\n * @returns {boolean}\n */\n compareNotifyContext(notifyContext) {\n return this._notifyContext === notifyContext;\n }\n\n /**\n * Get the notification method.\n *\n * @returns {function(Notification):void}\n */\n get notifyMethod() {\n return this._notifyMethod\n }\n\n /**\n * Set the notification method.\n *\n * The notification method should take one parameter of type `Notification`.
\n *\n * @param {function(Notification): void} notifyMethod - The function to be called when a notification is received.\n */\n set notifyMethod(notifyMethod) {\n this._notifyMethod = notifyMethod;\n }\n\n /**\n * Get the notifyContext\n *\n * @returns {Object}\n */\n get notifyContext() {\n return this._notifyContext;\n }\n\n /**\n * Set the notification context.\n *\n * @param {Object} notifyContext\n */\n set notifyContext(notifyContext) {\n this._notifyContext = notifyContext;\n }\n\n}\nexport { Observer }\n","/*\n * View.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Observer} from \"../patterns/observer/Observer.js\";\n\n/**\n * A Multiton `View` implementation.\n *\n * In PureMVC, the `View` class assumes these responsibilities:
\n *\n * \n * - Maintain a cache of `Mediator` instances.
\n * - Provide methods for registering, retrieving, and removing `Mediators`.
\n * - Notifying `Mediators` when they are registered or removed.
\n * - Managing the observer lists for each `Notification` in the application.
\n * - Providing a method for attaching `Observers` to a `Notification`'s observer list.
\n * - Providing a method for broadcasting a `Notification`.
\n * - Notifying the `Observers` of a given `Notification` when it broadcast.
\n *
\n *\n * @see Mediator Mediator\n * @see Observer Observer\n * @see Notification Notification\n *\n * @class View\n */\nclass View {\n\n /**\n * Constructor.\n *\n * This `View` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Multiton\n * Factory method `View.getInstance( multitonKey )`\n *\n * @constructor\n * @param {string} key\n *\n * @throws {Error} Error if instance for this Multiton key has already been constructed\n */\n constructor(key) {\n if (View.instanceMap.get(key) != null) throw new Error(View.MULTITON_MSG);\n /** @protected\n * @type {string} */\n this.multitonKey = key;\n View.instanceMap.set(this.multitonKey, this);\n /** @protected\n * @type {Map} */\n this.mediatorMap = new Map();\n /** @protected\n * @type {Map.>} */\n this.observerMap = new Map();\n this.initializeView();\n }\n\n /**\n * Initialize the Multiton View instance.
\n *\n * Called automatically by the constructor, this\n * is your opportunity to initialize the Multiton\n * instance in your subclass without overriding the\n * constructor.
\n */\n initializeView() {\n\n }\n\n /**\n * View Multiton factory method.\n *\n * @static\n * @param {string} key\n * @param {function(string):View} factory\n * @returns {View} the Multiton instance of `View`\n */\n static getInstance(key, factory) {\n if (View.instanceMap == null)\n /** @static\n * @type {Map} */\n View.instanceMap = new Map();\n if (View.instanceMap.get(key) == null) View.instanceMap.set(key, factory(key));\n return View.instanceMap.get(key);\n }\n\n /**\n * Register an `Observer` to be notified\n * of `Notifications` with a given name.
\n *\n * @param {string} notificationName the name of the `Notifications` to notify this `Observer` of\n * @param {Observer} observer the `Observer` to register\n */\n registerObserver(notificationName, observer) {\n if (this.observerMap.get(notificationName) != null) {\n let observers = this.observerMap.get(notificationName);\n observers.push(observer);\n } else {\n this.observerMap.set(notificationName, new Array(observer));\n }\n }\n\n /**\n * Notify the `Observers` for a particular `Notification`.
\n *\n * All previously attached `Observers` for this `Notification`'s\n * list are notified and are passed a reference to the `Notification` in\n * the order in which they were registered.
\n *\n * @param {Notification} notification the `Notification` to notify `Observers` of.\n */\n notifyObservers(notification) {\n if (this.observerMap.has(notification.name)) {\n // Copy observers from reference array to working array,\n // since the reference array may change during the notification loop\n let observers = this.observerMap.get(notification.name).slice();\n\n // Notify Observers from the working array\n for(let i = 0; i < observers.length; i++) {\n observers[i].notifyObserver(notification);\n }\n }\n }\n\n /**\n * Remove the observer for a given notifyContext from an observer list for a given Notification name.
\n *\n * @param {string} notificationName which observer list to remove from\n * @param {Object} notifyContext remove the observer with this object as its notifyContext\n */\n removeObserver(notificationName, notifyContext) {\n // the observer list for the notification under inspection\n let observers = this.observerMap.get(notificationName);\n\n // find the observer for the notifyContext\n for (let i = 0; i < observers.length; i++) {\n if (observers[i].compareNotifyContext(notifyContext) === true) {\n // there can only be one Observer for a given notifyContext\n // in any given Observer list, so remove it and break\n observers.splice(i, 1);\n break;\n }\n }\n\n // Also, when a Notification's Observer list length falls to\n // zero, delete the notification key from the observer map\n if (observers.length === 0) {\n this.observerMap.delete(notificationName);\n }\n }\n\n /**\n * Register a `Mediator` instance with the `View`.\n *\n * Registers the `Mediator` so that it can be retrieved by name,\n * and further interrogates the `Mediator` for its\n * `Notification` interests.
\n *\n * If the `Mediator` returns any `Notification`\n * names to be notified about, an `Observer` is created encapsulating\n * the `Mediator` instance's `handleNotification` method\n * and registering it as an `Observer` for all `Notifications` the\n * `Mediator` is interested in.
\n *\n * @param {Mediator} mediator a reference to the `Mediator` instance\n */\n registerMediator(mediator) {\n // do not allow re-registration (you must to removeMediator fist)\n if (this.mediatorMap.has(mediator.mediatorName) !== false) return;\n\n mediator.initializeNotifier(this.multitonKey);\n\n // Register the Mediator for retrieval by name\n this.mediatorMap.set(mediator.mediatorName, mediator);\n\n // Get Notification interests, if any.\n let interests = mediator.listNotificationInterests();\n\n // Register Mediator as an observer for each notification of interests\n if (interests.length > 0) {\n // Create Observer referencing this mediator's handleNotification method\n let observer = new Observer(mediator.handleNotification.bind(mediator), mediator); // check bind\n\n // Register Mediator as Observer for its list of Notification interests\n for (let i = 0; i < interests.length; i++) {\n this.registerObserver(interests[i], observer);\n }\n }\n\n // alert the mediator that it has been registered\n mediator.onRegister();\n }\n\n /**\n * Retrieve a `Mediator` from the `View`.\n *\n * @param {string} mediatorName the name of the `Mediator` instance to retrieve.\n * @returns {Mediator} the `Mediator` instance previously registered with the given `mediatorName`.\n */\n retrieveMediator(mediatorName) {\n return this.mediatorMap.get(mediatorName) || null;\n }\n\n /**\n * Remove a `Mediator` from the `View`.\n *\n * @param {string} mediatorName name of the `Mediator` instance to be removed.\n * @returns {Mediator} the `Mediator` that was removed from the `View`\n */\n removeMediator(mediatorName) {\n // Retrieve the named mediator\n let mediator = this.mediatorMap.get(mediatorName);\n\n if (mediator) {\n // for every notification this mediator is interested in...\n let interests = mediator.listNotificationInterests();\n for (let i = 0; i < interests.length; i++) {\n // remove the observer linking the mediator\n // to the notification interest\n this.removeObserver(interests[i], mediator);\n }\n\n // remove the mediator from the map\n this.mediatorMap.delete(mediatorName);\n\n // alert the mediator that it has been removed\n mediator.onRemove();\n }\n\n return mediator;\n }\n\n /**\n * Check if a Mediator is registered or not\n *\n * @param {string} mediatorName\n * @returns {boolean} whether a Mediator is registered with the given `mediatorName`.\n */\n hasMediator(mediatorName) {\n return this.mediatorMap.has(mediatorName);\n }\n\n /**\n * Remove a View instance\n *\n * @static\n * @param key multitonKey of View instance to remove\n */\n static removeView(key) {\n this.instanceMap.delete(key);\n }\n\n /**\n * Message Constants\n *\n * @static\n * @type {string}\n */\n static get MULTITON_MSG() { return \"View instance for this Multiton key already constructed!\" };\n\n}\nexport { View }\n","/*\n * Controller.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {View} from \"./View.js\"\nimport {Observer} from \"../patterns/observer/Observer.js\";\n\n/**\n * A Multiton `Controller` implementation.\n *\n * In PureMVC, the `Controller` class follows the\n * 'Command and Controller' strategy, and assumes these\n * responsibilities:
\n *\n * \n * - Remembering which `Command`s\n * are intended to handle which `Notifications`.
\n * - Registering itself as an `Observer` with\n * the `View` for each `Notification`\n * that it has a `Command` mapping for.
\n * - Creating a new instance of the proper `Command`\n * to handle a given `Notification` when notified by the `View`.
\n * - Calling the `Command`'s `execute`\n * method, passing in the `Notification`.
\n *
\n *\n * Your application must register `Commands` with the\n * Controller.
\n *\n * The simplest way is to subclass `Facade`,\n * and use its `initializeController` method to add your\n * registrations.
\n *\n * @see View View\n * @see Observer Observer\n * @see Notification Notification\n * @see SimpleCommand SimpleCommand\n * @see MacroCommand MacroCommand\n *\n * @class Controller\n */\nclass Controller {\n\n /**\n * Constructor.\n *\n * This `Controller` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Factory method,\n * passing the unique key for this instance\n * `Controller.getInstance( multitonKey )`
\n *\n * @throws {Error} Error if instance for this Multiton key has already been constructed\n *\n * @constructor\n * @param {string} key\n */\n constructor(key) {\n if (Controller.instanceMap[key] != null) throw new Error(Controller.MULTITON_MSG);\n /** @protected\n * @type {string} */\n this.multitonKey = key;\n Controller.instanceMap.set(this.multitonKey, this);\n /** @protected\n * @type {Map} */\n this.commandMap = new Map();\n this.initializeController();\n }\n\n /**\n * Initialize the Multiton `Controller` instance.\n *\n * Called automatically by the constructor.
\n *\n * Note that if you are using a subclass of `View`\n * in your application, you should also subclass `Controller`\n * and override the `initializeController` method in the\n * following way:
\n *\n * `\n *\t\t// ensure that the Controller is talking to my View implementation\n *\t\tinitializeController( )\n *\t\t{\n *\t\t\tthis.view = MyView.getInstance(this.multitonKey, (key) => new MyView(key));\n *\t\t}\n * `
\n *\n */\n initializeController() {\n /** @protected\n * @type {View} **/\n this.view = View.getInstance(this.multitonKey, (key) => new View(key));\n }\n\n /**\n * `Controller` Multiton Factory method.\n *\n * @static\n * @param {string} key\n * @param {function(string):Controller} factory\n * @returns {Controller} the Multiton instance of `Controller`\n */\n static getInstance(key, factory) {\n if (Controller.instanceMap == null)\n /** @static\n @type {Map} */\n Controller.instanceMap = new Map();\n if (Controller.instanceMap.get(key) == null) Controller.instanceMap.set(key, factory(key));\n return Controller.instanceMap.get(key);\n }\n\n /**\n * If a `Command` has previously been registered\n * to handle the given `Notification`, then it is executed.
\n *\n * @param {Notification} notification a `Notification`\n */\n executeCommand(notification) {\n let factory = this.commandMap.get(notification.name);\n if (factory == null) return;\n\n let commandInstance = factory();\n commandInstance.initializeNotifier(this.multitonKey);\n commandInstance.execute(notification);\n }\n\n /**\n * Register a particular `Command` class as the handler\n * for a particular `Notification`.
\n *\n * If an `Command` has already been registered to\n * handle `Notification`s with this name, it is no longer\n * used, the new `Command` is used instead.
\n *\n * The Observer for the new Command is only created if this the\n * first time a Command has been registered for this Notification name.
\n *\n * @param notificationName the name of the `Notification`\n * @param {function():SimpleCommand} factory\n */\n registerCommand(notificationName, factory) {\n if (this.commandMap.get(notificationName) == null) {\n this.view.registerObserver(notificationName, new Observer(this.executeCommand, this));\n }\n this.commandMap.set(notificationName, factory);\n }\n\n /**\n * Check if a Command is registered for a given Notification\n *\n * @param {string} notificationName\n * @return {boolean} whether a Command is currently registered for the given `notificationName`.\n */\n hasCommand(notificationName) {\n return this.commandMap.has(notificationName);\n }\n\n /**\n * Remove a previously registered `Command` to `Notification` mapping.\n *\n * @param {string} notificationName the name of the `Notification` to remove the `Command` mapping for\n */\n removeCommand(notificationName) {\n // if the Command is registered...\n if(this.hasCommand(notificationName)) {\n // remove the observer\n this.view.removeObserver(notificationName, this);\n\n // remove the command\n this.commandMap.delete(notificationName)\n }\n }\n\n /**\n * Remove a Controller instance\n *\n * @static\n * @param {string} key of Controller instance to remove\n */\n static removeController(key) {\n Controller.instanceMap.delete(key);\n }\n\n /**\n * Message Constants\n *\n * @static\n * @type {string}\n */\n static get MULTITON_MSG() { return \"Controller instance for this Multiton key already constructed!\" };\n}\nexport { Controller }\n","/*\n * Model.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\n/**\n * A Multiton `Model` implementation.\n *\n * In PureMVC, the `Model` class provides\n * access to model objects (Proxies) by named lookup.\n *\n *
The `Model` assumes these responsibilities:
\n *\n * \n * - Maintain a cache of `Proxy` instances.
\n * - Provide methods for registering, retrieving, and removing\n * `Proxy` instances.
\n *
\n *\n * Your application must register `Proxy` instances\n * with the `Model`. Typically, you use an\n * `Command` to create and register `Proxy`\n * instances once the `Facade` has initialized the Core\n * actors.
\n *\n * @see Proxy Proxy\n *\n * @class Model\n */\n\nclass Model {\n\n /**\n * Constructor.\n *\n * This `Model` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Multiton\n * Factory method `Model.getInstance( multitonKey )`\n *\n * @constructor\n * @param {string} key\n *\n * @throws {Error} Error if instance for this Multiton key instance has already been constructed\n */\n constructor(key) {\n if (Model.instanceMap.get(key) != null) throw new Error(Model.MULTITON_MSG);\n /** @protected\n * @type {string} */\n this.multitonKey = key;\n Model.instanceMap.set(this.multitonKey, this);\n /** @protected\n * @type {Map} */\n this.proxyMap = new Map();\n this.initializeModel();\n }\n\n /**\n * Initialize the `Model` instance.\n *\n * Called automatically by the constructor, this\n * is your opportunity to initialize the Multiton\n * instance in your subclass without overriding the\n * constructor.
\n *\n */\n initializeModel() {\n\n }\n\n /**\n * `Model` Multiton Factory method.\n *\n * @static\n * @param {string} key\n * @param {function(string):Model} factory\n * @returns {Model} the instance for this Multiton key\n */\n static getInstance(key, factory) {\n if (Model.instanceMap == null)\n /** @static\n @type {Map} */\n Model.instanceMap = new Map();\n if (Model.instanceMap.get(key) == null) Model.instanceMap.set(key, factory(key));\n return Model.instanceMap.get(key);\n }\n\n /**\n * Register a `Proxy` with the `Model`.\n *\n * @param {Proxy} proxy a `Proxy` to be held by the `Model`.\n */\n registerProxy(proxy) {\n proxy.initializeNotifier(this.multitonKey);\n this.proxyMap.set(proxy.proxyName, proxy);\n proxy.onRegister();\n }\n\n /**\n * Retrieve a `Proxy` from the `Model`.\n *\n * @param {string} proxyName\n * @returns {Proxy} the `Proxy` instance previously registered with the given `proxyName`.\n */\n retrieveProxy(proxyName) {\n return this.proxyMap.get(proxyName) || null;\n }\n\n /**\n * Check if a Proxy is registered\n *\n * @param {string} proxyName\n * @returns {boolean} whether a Proxy is currently registered with the given `proxyName`.\n */\n hasProxy(proxyName) {\n return this.proxyMap.has(proxyName);\n }\n\n /**\n * Remove a `Proxy` from the `Model`.\n *\n * @param {string} proxyName name of the `Proxy` instance to be removed.\n * @returns {Proxy} the `Proxy` that was removed from the `Model`\n */\n removeProxy(proxyName) {\n let proxy = this.proxyMap.get(proxyName);\n if (proxy != null) {\n this.proxyMap.delete(proxyName);\n proxy.onRemove();\n }\n return proxy;\n }\n\n /**\n * Remove a Model instance\n *\n * @static\n * @param key\n */\n static removeModel(key) {\n Model.instanceMap.delete(key);\n }\n\n /**\n * @static\n * @type {string}\n */\n static get MULTITON_MSG() { return \"Model instance for this Multiton key already constructed!\" };\n}\nexport { Model }","/*\n * Notification.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\n/**\n *\n * A base `Notification` implementation.\n *\n * PureMVC does not rely upon underlying event models such\n * as the one provided with Flash, and ActionScript 3 does\n * not have an inherent event model.
\n *\n * The Observer Pattern as implemented within PureMVC exists\n * to support event-driven communication between the\n * application and the actors of the MVC triad.
\n *\n * Notifications are not meant to be a replacement for Events\n * in Flex/Flash/Apollo. Generally, `Mediator` implementors\n * place event listeners on their view components, which they\n * then handle in the usual way. This may lead to the broadcast of `Notification`s to\n * trigger `Command`s or to communicate with other `Mediators`. `Proxy` and `Command`\n * instances communicate with each other and `Mediator`s\n * by broadcasting `Notification`s.
\n *\n * A key difference between Flash `Event`s and PureMVC\n * `Notification`s is that `Event`s follow the\n * 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy\n * until some parent component handles the `Event`, while\n * PureMVC `Notification`s follow a 'Publish/Subscribe'\n * pattern. PureMVC classes need not be related to each other in a\n * parent/child relationship in order to communicate with one another\n * using `Notification`s.
\n *\n * @class Notification\n */\nclass Notification {\n\n /**\n * Constructor.\n *\n * @constructor\n * @param {string} name - The name of the notification.\n * @param {Object|null} [body=null] - The body of the notification, defaults to `null`.\n * @param {string} [type=\"\"] - The type of the notification, defaults to an empty string.\n */\n constructor(name, body = null, type = \"\") {\n this._name = name;\n this._body = body;\n this._type = type;\n }\n\n /**\n * Get the name of the `Notification` instance.\n *\n * @returns {string}\n */\n get name() {\n return this._name;\n }\n\n /**\n * Get the body of the `Notification` instance.\n *\n * @returns {Object}\n */\n get body() {\n return this._body;\n }\n\n /**\n * Set the body of the `Notification` instance.\n *\n * @param {Object|null} body\n */\n set body(body) {\n this._body = body;\n }\n\n /**\n * Get the type of the `Notification` instance.\n *\n * @returns {string}\n */\n get type() {\n return this._type;\n }\n\n /**\n * Set the type of the `Notification` instance.\n *\n * @param {string} type\n */\n set type(type) {\n this._type = type;\n }\n\n /**\n * Get the string representation of the `Notification` instance.\n *\n * @returns {string}\n */\n toString() {\n let str= \"Notification Name: \" + this.name;\n str+= \"\\nBody:\" + ((this.body == null ) ? \"null\" : this.body.toString());\n str+= \"\\nType:\" + ((this.type == null ) ? \"null\" : this.type);\n return str;\n }\n\n}\nexport { Notification }\n","/*\n * Facade.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Controller} from \"../../core/Controller.js\";\nimport {Model} from \"../../core/Model.js\";\nimport {View} from \"../../core/View.js\";\nimport {Notification} from \"../observer/Notification.js\";\n\n/**\n * A base Multiton `Facade` implementation.\n *\n * @see Model Model\n * @see View View\n * @see Controller Controller\n *\n * @class Facade\n */\nclass Facade {\n\n /**\n * Constructor.\n *\n * This `Facade` implementation is a Multiton,\n * so you should not call the constructor\n * directly, but instead call the static Factory method,\n * passing the unique key for this instance\n * `Facade.getInstance( multitonKey )`
\n *\n * @constructor\n * @param {string} key\n * @throws {Error} Error if instance for this Multiton key has already been constructed\n */\n constructor(key) {\n if (Facade.instanceMap[key] != null) throw new Error(Facade.MULTITON_MSG);\n this.initializeNotifier(key);\n Facade.instanceMap.set(this.multitonKey, this);\n this.initializeFacade();\n }\n\n /**\n * Initialize the Multiton `Facade` instance.\n *\n * Called automatically by the constructor. Override in your\n * subclass to do any subclass specific initializations. Be\n * sure to call `super.initializeFacade()`, though.
\n */\n initializeFacade() {\n this.initializeModel();\n this.initializeController();\n this.initializeView();\n }\n\n /**\n * Facade Multiton Factory method\n *\n * @static\n * @param {string} key\n * @param {function(string):Facade} factory\n * @returns {Facade} the Multiton instance of the Facade\n */\n static getInstance(key, factory) {\n if (Facade.instanceMap == null)\n /** @static\n * @type {Map} */\n Facade.instanceMap = new Map();\n if (Facade.instanceMap.get(key) == null) Facade.instanceMap.set(key, factory(key));\n return Facade.instanceMap.get(key);\n }\n\n /**\n * Initialize the `Model`.\n *\n * Called by the `initializeFacade` method.\n * Override this method in your subclass of `Facade`\n * if one or both of the following are true:
\n *\n * \n * - You wish to initialize a different `Model`.
\n * - You have `Proxy`s to register with the Model that do not\n * retrieve a reference to the Facade at construction time.`
\n *
\n *\n * If you don't want to initialize a different `Model`,\n * call `super.initializeModel()` at the beginning of your\n * method, then register `Proxy`s.\n *\n * Note: This method is rarely overridden; in practice you are more\n * likely to use a `Command` to create and register `Proxy`s\n * with the `Model`, since `Proxy`s with mutable data will likely\n * need to send `Notification`s and thus will likely want to fetch a reference to\n * the `Facade` during their construction.
\n */\n initializeModel() {\n if (this.model != null) return;\n this.model = Model.getInstance(this.multitonKey, key => new Model(key));\n }\n\n /**\n * Initialize the `Controller`.\n *\n * Called by the `initializeFacade` method.\n * Override this method in your subclass of `Facade`\n * if one or both of the following are true:
\n *\n * \n * - You wish to initialize a different `Controller`.
\n * - You have `Commands` to register with the `Controller` at startup.`.
\n *
\n *\n * If you don't want to initialize a different `Controller`,\n * call `super.initializeController()` at the beginning of your\n * method, then register `Command`s.
\n */\n initializeController() {\n if (this.controller != null) return;\n this.controller = Controller.getInstance(this.multitonKey, key => new Controller(key));\n }\n\n /**\n * Initialize the `View`.\n *\n * Called by the `initializeFacade` method.\n * Override this method in your subclass of `Facade`\n * if one or both of the following are true:
\n *\n * \n * - You wish to initialize a different `View`.
\n * - You have `Observers` to register with the `View`
\n *
\n *\n * If you don't want to initialize a different `View`,\n * call `super.initializeView()` at the beginning of your\n * method, then register `Mediator` instances.
\n *\n * Note: This method is rarely overridden; in practice you are more\n * likely to use a `Command` to create and register `Mediator`s\n * with the `View`, since `Mediator` instances will need to send\n * `Notification`s and thus will likely want to fetch a reference\n * to the `Facade` during their construction.
\n */\n initializeView() {\n if (this.view != null) return;\n this.view = View.getInstance(this.multitonKey, key => new View(key));\n }\n\n /**\n * Register a `Command` with the `Controller` by Notification name.\n *\n * @param {string} notificationName the name of the `Notification` to associate the `Command` with\n * @param {function():SimpleCommand} factory a reference to the factory of the `Command`\n */\n registerCommand(notificationName, factory) {\n this.controller.registerCommand(notificationName, factory);\n }\n\n /**\n * Check if a Command is registered for a given Notification\n *\n * @param {string} notificationName\n * @returns {boolean} whether a Command is currently registered for the given `notificationName`.\n */\n hasCommand(notificationName) {\n return this.controller.hasCommand(notificationName);\n }\n\n /**\n * Remove a previously registered `Command` to `Notification` mapping from the Controller.\n *\n * @param {string} notificationName the name of the `Notification` to remove the `Command` mapping for\n */\n removeCommand(notificationName) {\n this.controller.removeCommand(notificationName);\n }\n\n /**\n * Register a `Proxy` with the `Model` by name.\n *\n * @param {Proxy} proxy the `Proxy` instance to be registered with the `Model`.\n */\n registerProxy(proxy) {\n this.model.registerProxy(proxy);\n }\n\n /**\n * Remove a `Proxy` from the `Model` by name.\n *\n * @param {string} proxyName the `Proxy` to remove from the `Model`.\n * @returns {Proxy} the `Proxy` that was removed from the `Model`\n */\n removeProxy(proxyName) {\n return this.model.removeProxy(proxyName);\n }\n\n /**\n * Check if a Proxy is registered\n *\n * @param {string} proxyName\n * @returns {boolean} whether a Proxy is currently registered with the given `proxyName`.\n */\n hasProxy(proxyName) {\n return this.model.hasProxy(proxyName);\n }\n\n /**\n * Retrieve a `Proxy` from the `Model` by name.\n *\n * @param {string} proxyName the name of the proxy to be retrieved.\n * @returns {Proxy} the `Proxy` instance previously registered with the given `proxyName`.\n */\n retrieveProxy(proxyName) {\n return this.model.retrieveProxy(proxyName);\n }\n\n /**\n * Register a `Mediator` with the `View`.\n *\n * @param {Mediator} mediator a reference to the `Mediator`\n */\n registerMediator(mediator) {\n this.view.registerMediator(mediator);\n }\n\n /**\n * Remove a `Mediator` from the `View`.\n *\n * @param {string} mediatorName name of the `Mediator` to be removed.\n * @returns {Mediator} the `Mediator` that was removed from the `View`\n */\n removeMediator(mediatorName) {\n return this.view.removeMediator(mediatorName);\n }\n\n /**\n * Check if a Mediator is registered or not\n *\n * @param {string} mediatorName\n * @returns {boolean} whether a Mediator is registered with the given `mediatorName`.\n */\n hasMediator(mediatorName) {\n return this.view.hasMediator(mediatorName);\n }\n\n /**\n * Retrieve a `Mediator` from the `View`.\n *\n * @param {string} mediatorName\n * @returns {Mediator} the `Mediator` previously registered with the given `mediatorName`.\n */\n retrieveMediator(mediatorName) {\n return this.view.retrieveMediator(mediatorName);\n }\n\n /**\n * Create and send an `Notification`.\n *\n * Keeps us from having to construct new notification\n * instances in our implementation code.
\n *\n * @param {string} notificationName the name of the notification to send\n * @param {Object} [body] body the body of the notification (optional)\n * @param {string} [type] type the type of the notification (optional)\n */\n sendNotification(notificationName, body = null, type = \"\") {\n this.notifyObservers(new Notification(notificationName, body, type));\n }\n\n /**\n * Notify `Observer`s.\n *\n * This method is left public mostly for backward\n * compatibility, and to allow you to send custom\n * notification classes using the facade.
\n *\n * Usually you should just call sendNotification\n * and pass the parameters, never having to\n * construct the notification yourself.
\n *\n * @param {Notification} notification the `Notification` to have the `View` notify `Observers` of.\n */\n notifyObservers(notification) {\n this.view.notifyObservers(notification);\n }\n\n /**\n * Set the Multiton key for this facade instance.\n *\n * Not called directly, but instead from the\n * constructor when getInstance is invoked.\n * It is necessary to be public in order to\n * implement Notifier.
\n */\n initializeNotifier(key) {\n this.multitonKey = key;\n }\n\n /**\n * Check if a Core is registered or not\n *\n * @static\n * @param {string} key the multiton key for the Core in question\n * @returns {boolean} whether a Core is registered with the given `key`.\n */\n static hasCore(key) {\n return this.instanceMap.has(key);\n }\n\n /**\n * Remove a Core.\n *\n * Remove the Model, View, Controller and Facade\n * instances for the given key.
\n *\n * @static\n * @param {string} key multitonKey of the Core to remove\n */\n static removeCore(key) {\n if (Facade.instanceMap.get(key) == null) return;\n Model.removeModel(key);\n View.removeView(key);\n Controller.removeController(key);\n this.instanceMap.delete(key);\n }\n\n /**\n * Message Constants\n *\n * @static\n * @returns {string}\n */\n static get MULTITON_MSG() {return \"Facade instance for this Multiton key already constructed!\"};\n}\nexport { Facade }\n","/*\n * Notifier.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Facade} from \"../facade/Facade.js\";\n\n/**\n * A Base `Notifier` implementation.\n *\n * `MacroCommand, Command, Mediator` and `Proxy`\n * all have a need to send `Notifications`.
\n *\n *
The `Notifier` interface provides a common method called\n * `sendNotification` that relieves implementation code of\n * the necessity to actually construct `Notifications`.
\n *\n * The `Notifier` class, which all the above-mentioned classes\n * extend, provides an initialized reference to the `Facade`\n * Multiton, which is required for the convenience method\n * for sending `Notifications`, but also eases implementation as these\n * classes have frequent `Facade` interactions and usually require\n * access to the facade anyway.
\n *\n * NOTE: In the MultiCore version of the framework, there is one caveat to\n * notifiers, they cannot send notifications or reach the facade until they\n * have a valid multitonKey.
\n *\n * The multitonKey is set:\n * * on a Command when it is executed by the Controller\n * * on a Mediator is registered with the View\n * * on a Proxy is registered with the Model.\n *\n * @see Proxy Proxy\n * @see Facade Facade\n * @see Mediator Mediator\n * @see MacroCommand MacroCommand\n * @see SimpleCommand SimpleCommand\n *\n * @class Notifier\n */\nclass Notifier {\n\n constructor() {}\n\n /**\n * Create and send an `Notification`.\n *\n * Keeps us from having to construct new Notification\n * instances in our implementation code.
\n *\n * @param {string} notificationName\n * @param {Object} [body] body\n * @param {string} [type] type\n */\n sendNotification (notificationName, body = null, type = \"\") {\n if (this.facade != null) {\n this.facade.sendNotification(notificationName, body, type);\n }\n }\n\n /**\n * Initialize this Notifier instance.\n *\n * This is how a Notifier gets its multitonKey.\n * Calls to sendNotification or to access the\n * facade will fail until after this method\n * has been called.
\n *\n * Mediators, Commands or Proxies may override\n * this method in order to send notifications\n * or access the Multiton Facade instance as\n * soon as possible. They CANNOT access the facade\n * in their constructors, since this method will not\n * yet have been called.
\n *\n * @param {string} key the multitonKey for this Notifier to use\n */\n initializeNotifier(key) {\n this.multitonKey = key;\n }\n\n /**\n * Return the Multiton Facade instance\n *\n * @typedef {Facade} Facade\n *\n * @throws {Error}\n */\n get facade() {\n if (this.multitonKey == null) throw new Error(Notifier.MULTITON_MSG);\n return Facade.getInstance(this.multitonKey, key => new Facade(key));\n }\n\n /**\n * Message Constants\n *\n * @static\n * @returns {string}\n */\n static get MULTITON_MSG() { return \"multitonKey for this Notifier not yet initialized!\" }\n}\nexport { Notifier }\n","/*\n * SimpleCommand.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Notifier} from \"../observer/Notifier.js\";\n\n/**\n * A base `Command` implementation.\n *\n * Your subclass should override the `execute`\n * method where your business logic will handle the `Notification`.
\n *\n * @see Controller Controller\n * @see Notification Notification\n * @see MacroCommand MacroCommand\n *\n * @class SimpleCommand\n */\nclass SimpleCommand extends Notifier {\n\n constructor() {\n super();\n }\n\n /**\n * Fulfill the use-case initiated by the given `Notification`.\n *\n * In the Command Pattern, an application use-case typically\n * begins with some user action, which results in a `Notification` being broadcast, which\n * is handled by business logic in the `execute` method of an\n * `Command`.
\n *\n * @param {Notification} notification\n */\n execute(notification) {\n\n }\n\n}\nexport { SimpleCommand }\n","/*\n * MacroCommand.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {SimpleCommand} from \"./SimpleCommand.js\";\n\n/**\n * A base `Command` implementation that executes other `Command`s.\n *\n * A `MacroCommand` maintains a list of\n * `Command` Class references called SubCommands.
\n *\n * When `execute` is called, the `MacroCommand`\n * instantiates and calls `execute` on each of its SubCommands turn.\n * Each SubCommand will be passed a reference to the original\n * `Notification` that was passed to the `MacroCommand`'s\n * `execute` method.
\n *\n * Unlike `SimpleCommand`, your subclass\n * should not override `execute`, but instead, should\n * override the `initializeMacroCommand` method,\n * calling `addSubCommand` once for each SubCommand\n * to be executed.
\n *\n * @see Controller Controller\n * @see Notification Notification\n * @see SimpleCommand SimpleCommand\n *\n * @class MacroCommand\n */\nclass MacroCommand extends SimpleCommand {\n\n /**\n * Constructor.\n *\n * You should not need to define a constructor,\n * instead, override the `initializeMacroCommand`\n * method.
\n *\n * If your subclass does define a constructor, be\n * sure to call `super()`.
\n *\n * @constructor\n */\n constructor() {\n super();\n /** @protected\n * @type {Array.} */\n this.subCommands = [];\n this.initializeMacroCommand();\n }\n\n /**\n * Initialize the `MacroCommand`.\n *\n * In your subclass, override this method to\n * initialize the `MacroCommand`'s SubCommand\n * list with `Command` class references like\n * this:
\n *\n * `\n *\t\t// Initialize MyMacroCommand\n *\t\tinitializeMacroCommand() {\n *\t\t\tthis.addSubCommand(() => new app.FirstCommand());\n *\t\t\tthis.addSubCommand(() => new app.SecondCommand());\n *\t\t\tthis.addSubCommand(() => new app.ThirdCommand());\n *\t\t}\n * `
\n *\n * Note that SubCommands may be any `Command` implementor,\n * `MacroCommand`s or `SimpleCommands` are both acceptable.\n */\n initializeMacroCommand() {\n\n }\n\n /**\n * Add a SubCommand.\n *\n *
The SubCommands will be called in First In/First Out (FIFO)\n * order.
\n *\n * @param {function():SimpleCommand} factory\n */\n addSubCommand(factory) {\n this.subCommands.push(factory);\n }\n\n /**\n * Execute this `MacroCommand`'s SubCommands.\n *\n * The SubCommands will be called in First In/First Out (FIFO)\n * order.
\n *\n * @param {Notification} notification\n */\n execute(notification) {\n while(this.subCommands.length > 0) {\n let factory = this.subCommands.shift();\n let commandInstance = factory();\n commandInstance.initializeNotifier(this.multitonKey);\n commandInstance.execute(notification);\n }\n }\n\n}\nexport { MacroCommand }\n","/*\n * Mediator.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Notifier} from \"../observer/Notifier.js\";\n\n/**\n * A base `Mediator` implementation.\n *\n * @see View View\n *\n * @class Mediator\n */\nclass Mediator extends Notifier {\n\n /**\n * Constructor.\n *\n * @constructor\n * @param {string} mediatorName\n * @param {Object} [viewComponent] viewComponent\n */\n constructor(mediatorName, viewComponent = null) {\n super();\n this._mediatorName = mediatorName || Mediator.NAME;\n this._viewComponent = viewComponent;\n }\n\n /**\n * Called by the View when the Mediator is registered\n */\n onRegister() {\n\n }\n\n /**\n * Called by the View when the Mediator is removed\n */\n onRemove() {\n\n }\n\n /**\n * List the `Notification` names this\n * `Mediator` is interested in being notified of.\n *\n * @returns {string[]}\n */\n listNotificationInterests() {\n return [];\n }\n\n /**\n * Handle `Notification`s.\n *\n * \n * Typically this will be handled in a switch statement,\n * with one 'case' entry per `Notification`\n * the `Mediator` is interested in.\n *\n * @param {Notification} notification\n */\n handleNotification(notification) {\n\n }\n\n /**\n * the mediator name\n *\n * @returns {string}\n */\n get mediatorName() {\n return this._mediatorName;\n }\n\n /**\n * Get the `Mediator`'s view component.\n *\n *
\n * Additionally, an implicit getter will usually\n * be defined in the subclass that casts the view\n * object to a type, like this:
\n *\n * @returns {Object}\n */\n get viewComponent() {\n return this._viewComponent;\n }\n\n /**\n * Set the `Mediator`'s view component.\n *\n * @param {Object} viewComponent\n */\n set viewComponent(viewComponent) {\n this._viewComponent = viewComponent;\n }\n\n /**\n * The name of the `Mediator`.\n *\n * Typically, a `Mediator` will be written to serve\n * one specific control or group controls and so,\n * will not have a need to be dynamically named.
\n *\n * @static\n * @returns {string}\n */\n static get NAME() { return \"Mediator\" }\n}\nexport { Mediator }\n","/*\n * Proxy.js\n * PureMVC JavaScript Multicore\n *\n * Copyright(c) 2023 Saad Shams \n * Your reuse is governed by the BSD License\n*/\n\nimport {Notifier} from \"../observer/Notifier.js\";\n\n/**\n * A base `Proxy` implementation.\n *\n * In PureMVC, `Proxy` classes are used to manage parts of the\n * application's data model.
\n *\n * A `Proxy` might simply manage a reference to a local data object,\n * in which case interacting with it might involve setting and\n * getting of its data in synchronous fashion.
\n *\n * `Proxy` classes are also used to encapsulate the application's\n * interaction with remote services to save or retrieve data, in which case,\n * we adopt an asynchronous idiom; setting data (or calling a method) on the\n * `Proxy` and listening for a `Notification` to be sent\n * when the `Proxy` has retrieved the data from the service.
\n *\n * @see Model Model\n *\n * @class Proxy\n */\nclass Proxy extends Notifier {\n /**\n * Constructor\n *\n * @constructor\n * @param {string} proxyName\n * @param {Object} [data]\n */\n constructor(proxyName, data = null) {\n super();\n /** @protected\n * @type {string} */\n this._proxyName = proxyName || Proxy.NAME;\n /** @protected\n * @type {Object} */\n this._data = data;\n }\n\n /**\n * Called by the Model when the Proxy is registered\n */\n onRegister() {}\n\n /**\n * Called by the Model when the Proxy is removed\n */\n onRemove() {}\n\n /**\n * Get the proxy name\n *\n * @returns {string}\n */\n get proxyName() {\n return this._proxyName;\n }\n\n /**\n * Get the data object\n *\n * @returns {Object}\n */\n get data () {\n return this._data;\n }\n\n /**\n * Set the data object\n *\n * @param {Object} data\n */\n set data(data) {\n this._data = data;\n }\n\n /**\n *\n * @static\n * @returns {string}\n */\n static get NAME() { return \"Proxy\" }\n}\nexport { Proxy }\n"],"names":["Observer","constructor","notifyMethod","notifyContext","this","_notifyMethod","_notifyContext","notifyObserver","notification","call","compareNotifyContext","View","key","instanceMap","get","Error","MULTITON_MSG","multitonKey","set","mediatorMap","Map","observerMap","initializeView","getInstance","factory","registerObserver","notificationName","observer","push","Array","notifyObservers","has","name","observers","slice","i","length","removeObserver","splice","delete","registerMediator","mediator","mediatorName","initializeNotifier","interests","listNotificationInterests","handleNotification","bind","onRegister","retrieveMediator","removeMediator","onRemove","hasMediator","removeView","Controller","commandMap","initializeController","view","executeCommand","commandInstance","execute","registerCommand","hasCommand","removeCommand","removeController","Model","proxyMap","initializeModel","registerProxy","proxy","proxyName","retrieveProxy","hasProxy","removeProxy","removeModel","Notification","body","type","_name","_body","_type","toString","str","Facade","initializeFacade","model","controller","sendNotification","hasCore","removeCore","Notifier","facade","SimpleCommand","super","MacroCommand","subCommands","initializeMacroCommand","addSubCommand","shift","Mediator","viewComponent","_mediatorName","NAME","_viewComponent","Proxy","data","_proxyName","_data"],"mappings":"AA0BA,MAAMA,EAWF,WAAAC,CAAYC,EAAcC,GACtBC,KAAKC,cAAgBH,EACrBE,KAAKE,eAAiBH,CACzB,CAOD,cAAAI,CAAeC,GACXJ,KAAKC,cAAcI,KAAKL,KAAKE,eAAgBE,EAChD,CAQD,oBAAAE,CAAqBP,GACjB,OAAOC,KAAKE,iBAAmBH,CAClC,CAOD,gBAAID,GACA,OAAOE,KAAKC,aACf,CASD,gBAAIH,CAAaA,GACbE,KAAKC,cAAgBH,CACxB,CAOD,iBAAIC,GACA,OAAOC,KAAKE,cACf,CAOD,iBAAIH,CAAcA,GACdC,KAAKE,eAAiBH,CACzB,EClEL,MAAMQ,EAeF,WAAAV,CAAYW,GACR,GAAiC,MAA7BD,EAAKE,YAAYC,IAAIF,GAAc,MAAM,IAAIG,MAAMJ,EAAKK,cAG5DZ,KAAKa,YAAcL,EACnBD,EAAKE,YAAYK,IAAId,KAAKa,YAAab,MAGvCA,KAAKe,YAAc,IAAIC,IAGvBhB,KAAKiB,YAAc,IAAID,IACvBhB,KAAKkB,gBACR,CAUD,cAAAA,GAEC,CAUD,kBAAOC,CAAYX,EAAKY,GAMpB,OALwB,MAApBb,EAAKE,cAGLF,EAAKE,YAAc,IAAIO,KACM,MAA7BT,EAAKE,YAAYC,IAAIF,IAAcD,EAAKE,YAAYK,IAAIN,EAAKY,EAAQZ,IAClED,EAAKE,YAAYC,IAAIF,EAC/B,CASD,gBAAAa,CAAiBC,EAAkBC,GAC/B,GAA8C,MAA1CvB,KAAKiB,YAAYP,IAAIY,GAA2B,CAChCtB,KAAKiB,YAAYP,IAAIY,GAC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,CAQD,yBAAAN,GACI,MAAO,EACV,CAYD,kBAAAC,CAAmBtC,GAElB,CAOD,gBAAIkC,GACA,OAAOtC,KAAKiG,aACf,CAYD,iBAAID,GACA,OAAOhG,KAAKmG,cACf,CAOD,iBAAIH,CAAcA,GACdhG,KAAKmG,eAAiBH,CACzB,CAYD,eAAWE,GAAS,MAAO,UAAY,EClF3C,MAAME,UAAcd,EAQhB,WAAAzF,CAAYqE,EAAWmC,EAAO,MAC1BZ,QAGAzF,KAAKsG,WAAapC,GAAakC,EAAMF,KAGrClG,KAAKuG,MAAQF,CAChB,CAKD,UAAAzD,GAAe,CAKf,QAAAG,GAAa,CAOb,aAAImB,GACA,OAAOlE,KAAKsG,UACf,CAOD,QAAID,GACA,OAAOrG,KAAKuG,KACf,CAOD,QAAIF,CAAKA,GACLrG,KAAKuG,MAAQF,CAChB,CAOD,eAAWH,GAAS,MAAO,OAAS"}
\ No newline at end of file
diff --git a/build/rollup.conf.mjs b/build/rollup.conf.mjs
index 653bf5b..eb8d7dd 100644
--- a/build/rollup.conf.mjs
+++ b/build/rollup.conf.mjs
@@ -5,23 +5,23 @@ export default [
input: "src/index.js",
output: [
{
- file: "bin/esm/puremvc.js",
+ file: "bin/esm/index.js",
format: "esm",
sourcemap: false
},
{
- file: "bin/esm/puremvc.min.js",
+ file: "bin/esm/index.min.js",
format: "esm",
plugins: [terser()],
sourcemap: true
},
{
- file: "bin/cjs/puremvc.cjs",
+ file: "bin/cjs/index.cjs",
format: "cjs",
sourcemap: false
},
{
- file: "bin/cjs/puremvc.min.cjs",
+ file: "bin/cjs/index.min.cjs",
format: "cjs",
plugins: [terser()],
sourcemap: true
diff --git a/package.json b/package.json
index a102e5d..bf4fe0c 100755
--- a/package.json
+++ b/package.json
@@ -3,16 +3,16 @@
"version": "2.0.7",
"description": "PureMVC MultiCore Framework for JavaScript",
"type": "module",
- "main": "bin/cjs/puremvc.cjs",
- "module": "bin/esm/puremvc.js",
+ "main": "bin/cjs/index.cjs",
+ "module": "bin/esm/index.js",
"exports": {
".": {
- "require": "./bin/cjs/puremvc.cjs",
- "import": "./bin/esm/puremvc.js"
+ "require": "./bin/cjs/index.cjs",
+ "import": "./bin/esm/index.js"
}
},
"bin": {
- "puremvc-js-multicore-framework": "bin/esm/puremvc.js"
+ "puremvc-js-multicore-framework": "bin/esm/index.js"
},
"scripts": {
"build": "npm run clean && npm run build:lib",
@@ -56,7 +56,8 @@
],
"directories": {
"doc": "docs",
- "test": "test"
+ "test": "test",
+ "bin": "bin"
},
"babel": {
"presets": [
diff --git a/src/core/Controller.js b/src/core/Controller.js
index f076258..42b945f 100644
--- a/src/core/Controller.js
+++ b/src/core/Controller.js
@@ -54,10 +54,10 @@ class Controller {
* passing the unique key for this instance
* `Controller.getInstance( multitonKey )`
*
- * @throws {Error} Error if instance for this Multiton key has already been constructed
- *
* @constructor
* @param {string} key
+ *
+ * @throws {Error} Error if instance for this Multiton key has already been constructed
*/
constructor(key) {
if (Controller.instanceMap[key] != null) throw new Error(Controller.MULTITON_MSG);
diff --git a/src/core/Model.js b/src/core/Model.js
index 0b64df7..5436d6c 100644
--- a/src/core/Model.js
+++ b/src/core/Model.js
@@ -30,7 +30,6 @@
*
* @class Model
*/
-
class Model {
/**
@@ -150,4 +149,4 @@ class Model {
*/
static get MULTITON_MSG() { return "Model instance for this Multiton key already constructed!" };
}
-export { Model }
\ No newline at end of file
+export { Model }
diff --git a/src/patterns/facade/Facade.js b/src/patterns/facade/Facade.js
index ec4716a..e9c1a57 100644
--- a/src/patterns/facade/Facade.js
+++ b/src/patterns/facade/Facade.js
@@ -33,6 +33,7 @@ class Facade {
*
* @constructor
* @param {string} key
+ *
* @throws {Error} Error if instance for this Multiton key has already been constructed
*/
constructor(key) {
@@ -197,7 +198,7 @@ class Facade {
}
/**
- * Check if a Proxy is registered
+ * Check if a `Proxy` is registered
*
* @param {string} proxyName
* @returns {boolean} whether a Proxy is currently registered with the given `proxyName`.
@@ -236,7 +237,7 @@ class Facade {
}
/**
- * Check if a Mediator is registered or not
+ * Check if a `Mediator` is registered or not
*
* @param {string} mediatorName
* @returns {boolean} whether a Mediator is registered with the given `mediatorName`.
@@ -276,7 +277,7 @@ class Facade {
* compatibility, and to allow you to send custom
* notification classes using the facade.
*
- * Usually you should just call sendNotification
+ *
Usually you should just call `sendNotification`
* and pass the parameters, never having to
* construct the notification yourself.
*
diff --git a/src/patterns/mediator/Mediator.js b/src/patterns/mediator/Mediator.js
index 9f031a2..3a64824 100644
--- a/src/patterns/mediator/Mediator.js
+++ b/src/patterns/mediator/Mediator.js
@@ -21,10 +21,10 @@ class Mediator extends Notifier {
* Constructor.
*
* @constructor
- * @param {string} mediatorName
- * @param {Object} [viewComponent] viewComponent
+ * @param {string | null} [mediatorName=null]
+ * @param {Object | null} [viewComponent=null]
*/
- constructor(mediatorName, viewComponent = null) {
+ constructor(mediatorName = null, viewComponent = null) {
super();
this._mediatorName = mediatorName || Mediator.NAME;
this._viewComponent = viewComponent;
@@ -85,7 +85,7 @@ class Mediator extends Notifier {
* be defined in the subclass that casts the view
* object to a type, like this:
*
- * @returns {Object}
+ * @returns {Object | null}
*/
get viewComponent() {
return this._viewComponent;
diff --git a/src/patterns/observer/Notification.js b/src/patterns/observer/Notification.js
index fc46bdf..3642425 100644
--- a/src/patterns/observer/Notification.js
+++ b/src/patterns/observer/Notification.js
@@ -7,7 +7,6 @@
*/
/**
- *
* A base `Notification` implementation.
*
* PureMVC does not rely upon underlying event models such
@@ -65,7 +64,7 @@ class Notification {
/**
* Get the body of the `Notification` instance.
*
- * @returns {Object}
+ * @returns {Object | null}
*/
get body() {
return this._body;
diff --git a/src/patterns/observer/Observer.js b/src/patterns/observer/Observer.js
index fe065c0..accedde 100644
--- a/src/patterns/observer/Observer.js
+++ b/src/patterns/observer/Observer.js
@@ -32,12 +32,12 @@ class Observer {
*
The notification method on the interested object should take
* one parameter of type `Notification`
*
- * @param {function(Notification):void} notifyMethod
- * @param {Object} notifyContext
+ * @param {function(Notification):void | null} [notify = null]
+ * @param {Object | null} [context = null]
*/
- constructor(notifyMethod, notifyContext) {
- this._notifyMethod = notifyMethod;
- this._notifyContext = notifyContext;
+ constructor(notify = null, context = null) {
+ this._notifyMethod = notify;
+ this._notifyContext = context;
}
/**
diff --git a/src/patterns/proxy/Proxy.js b/src/patterns/proxy/Proxy.js
index 8e9fcac..799a0f0 100755
--- a/src/patterns/proxy/Proxy.js
+++ b/src/patterns/proxy/Proxy.js
@@ -33,16 +33,16 @@ class Proxy extends Notifier {
* Constructor
*
* @constructor
- * @param {string} proxyName
- * @param {Object} [data]
+ * @param {string | null} [proxyName=null]
+ * @param {Object | null} [data=null]
*/
- constructor(proxyName, data = null) {
+ constructor(proxyName = null, data = null) {
super();
/** @protected
* @type {string} */
this._proxyName = proxyName || Proxy.NAME;
/** @protected
- * @type {Object} */
+ * @type {Object | null} */
this._data = data;
}
@@ -68,7 +68,7 @@ class Proxy extends Notifier {
/**
* Get the data object
*
- * @returns {Object}
+ * @returns {Object | null}
*/
get data () {
return this._data;
diff --git a/test/core/ControllerTest.js b/test/core/ControllerTest.js
index 99247af..2898a5c 100644
--- a/test/core/ControllerTest.js
+++ b/test/core/ControllerTest.js
@@ -1,3 +1,11 @@
+//
+// ControllerTest.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import chai from "chai"
import {Controller, View, Notification} from "../../src/index.js";
import {ControllerTestCommand} from "./ControllerTestCommand.js";
diff --git a/test/core/ControllerTestCommand.js b/test/core/ControllerTestCommand.js
index d90cbe2..acc2cc1 100644
--- a/test/core/ControllerTestCommand.js
+++ b/test/core/ControllerTestCommand.js
@@ -1,7 +1,14 @@
+//
+// ControllerTestCommand.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {SimpleCommand} from "../../src/index.js";
/**
- /**
* A SimpleCommand subclass used by ControllerTest.
*
* @see ControllerTest
diff --git a/test/core/ControllerTestCommand2.js b/test/core/ControllerTestCommand2.js
index 4e5e58c..9d6912e 100644
--- a/test/core/ControllerTestCommand2.js
+++ b/test/core/ControllerTestCommand2.js
@@ -1,3 +1,11 @@
+//
+// ControllerTestCommand2.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {SimpleCommand} from "../../src/index.js";
/**
diff --git a/test/core/ControllerTestVO.js b/test/core/ControllerTestVO.js
index 5a4d442..fc52658 100644
--- a/test/core/ControllerTestVO.js
+++ b/test/core/ControllerTestVO.js
@@ -1,3 +1,11 @@
+//
+// ControllerTestVO.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
/**
* A utility class used by ControllerTest.
*
diff --git a/test/core/ModelTest.js b/test/core/ModelTest.js
index 22f4562..cb526ae 100644
--- a/test/core/ModelTest.js
+++ b/test/core/ModelTest.js
@@ -1,3 +1,11 @@
+//
+// ModelTest.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {Model, Proxy} from "../../src/index.js";
import chai from "chai"
import { ModelTestProxy } from "./ModelTestProxy.js"
diff --git a/test/core/ModelTestProxy.js b/test/core/ModelTestProxy.js
index 497085c..06ca877 100644
--- a/test/core/ModelTestProxy.js
+++ b/test/core/ModelTestProxy.js
@@ -1,3 +1,11 @@
+//
+// ModelTestProxy.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {Proxy} from "../../src/index.js"
/**
diff --git a/test/core/ViewTest.js b/test/core/ViewTest.js
index 6f89389..e05b63e 100644
--- a/test/core/ViewTest.js
+++ b/test/core/ViewTest.js
@@ -1,3 +1,11 @@
+//
+// ViewTest.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import chai from "chai"
import {View, Notification, Observer, Mediator} from "../../src/index.js";
import {ViewTestMediator} from "./ViewTestMediator.js";
@@ -84,8 +92,11 @@ describe("ViewTest", () => {
chai.assert.isTrue(mediator !== undefined, "ViewTestMediator is not null");
});
+ /**
+ * Tests the hasMediator Method
+ */
it("testHasMediator", () => {
- // register a Mediator
+ // Get the Multiton View instance
let view = View.getInstance("ViewTestKey4", key => new View(key));
// Create and register the test mediator
@@ -180,6 +191,8 @@ describe("ViewTest", () => {
// Remove the Mediator
view.removeMediator(ViewTestMediator.NAME);
+
+ chai.assert.isTrue(view.retrieveMediator(ViewTestMediator.NAME) == null, "view.retrieveMediator(ViewTestMediator.NAME) == null");
});
/**
@@ -223,6 +236,11 @@ describe("ViewTest", () => {
chai.assert.isTrue(viewTest.lastNotification !== ViewTestNote.NOTE2, "Expecting lastNotification === NOTE2");
});
+ /**
+ * Tests registering a Mediator for 2 different notifications, removing the
+ * Mediator from the View, and seeing that neither notification causes the
+ * Mediator to be notified. Added for the fix deployed in version 1.7
+ */
it("testRemoveOneOfTwoMediatorsAndSubsequentNotify", () => {
let viewTest = { lastNotification: "" };
diff --git a/test/core/ViewTestMediator.js b/test/core/ViewTestMediator.js
index 0461f60..1c8177b 100644
--- a/test/core/ViewTestMediator.js
+++ b/test/core/ViewTestMediator.js
@@ -1,3 +1,11 @@
+//
+// ViewTestMediator.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {Mediator} from "../../src/index.js";
/**
diff --git a/test/core/ViewTestMediator2.js b/test/core/ViewTestMediator2.js
index 0c32277..298ee85 100644
--- a/test/core/ViewTestMediator2.js
+++ b/test/core/ViewTestMediator2.js
@@ -1,3 +1,11 @@
+//
+// ViewTestMediator2.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {Mediator} from "../../src/index.js";
import {ViewTestNote} from "./ViewTestNote.js";
diff --git a/test/core/ViewTestMediator3.js b/test/core/ViewTestMediator3.js
index 5889e27..16ad360 100644
--- a/test/core/ViewTestMediator3.js
+++ b/test/core/ViewTestMediator3.js
@@ -1,3 +1,11 @@
+//
+// ViewTestMediator3.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {Mediator} from "../../src/index.js";
import {ViewTestNote} from "./ViewTestNote.js";
diff --git a/test/core/ViewTestMediator4.js b/test/core/ViewTestMediator4.js
index 3d7543d..f2d8f4c 100644
--- a/test/core/ViewTestMediator4.js
+++ b/test/core/ViewTestMediator4.js
@@ -1,3 +1,11 @@
+//
+// ViewTestMediator4.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {Mediator} from "../../src/index.js";
/**
diff --git a/test/core/ViewTestMediator5.js b/test/core/ViewTestMediator5.js
index cbd2928..003a72d 100644
--- a/test/core/ViewTestMediator5.js
+++ b/test/core/ViewTestMediator5.js
@@ -1,3 +1,11 @@
+//
+// ViewTestMediator5.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {Mediator} from "../../src/index.js";
import {ViewTestNote} from "./ViewTestNote.js";
diff --git a/test/core/ViewTestMediator6.js b/test/core/ViewTestMediator6.js
index 5e29a56..2fa7318 100644
--- a/test/core/ViewTestMediator6.js
+++ b/test/core/ViewTestMediator6.js
@@ -1,3 +1,11 @@
+//
+// ViewTestMediator6.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {Mediator} from "../../src/index.js";
import {ViewTestNote} from "./ViewTestNote.js";
diff --git a/test/core/ViewTestNote.js b/test/core/ViewTestNote.js
index 29ef394..afc8e76 100644
--- a/test/core/ViewTestNote.js
+++ b/test/core/ViewTestNote.js
@@ -1,3 +1,11 @@
+//
+// ViewTestNote.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {Notification} from "../../src/index.js"
/**
@@ -25,7 +33,6 @@ class ViewTestNote extends Notification {
/**
*
* @param {Object} body
- * @static
* @returns {ViewTestNote}
*/
static create(body) {
diff --git a/test/patterns/command/MacroCommandTest.js b/test/patterns/command/MacroCommandTest.js
index c42c287..1340915 100644
--- a/test/patterns/command/MacroCommandTest.js
+++ b/test/patterns/command/MacroCommandTest.js
@@ -1,7 +1,16 @@
+//
+// MacroCommandTest.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import chai from "chai"
import {Notification} from "../../../src/index.js"
import {MacroCommandTestCommand} from "./MacroCommandTestCommand.js"
import {MacroCommandTestVO} from "./MacroCommandTestVO.js"
+
/**
* Test the PureMVC SimpleCommand class.
*
diff --git a/test/patterns/command/MacroCommandTestCommand.js b/test/patterns/command/MacroCommandTestCommand.js
index 9669ed4..777ec79 100644
--- a/test/patterns/command/MacroCommandTestCommand.js
+++ b/test/patterns/command/MacroCommandTestCommand.js
@@ -1,6 +1,15 @@
+//
+// MacroCommandTestCommand.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {MacroCommand} from "../../../src/index.js";
import {MacroCommandTestSub1Command} from "./MacroCommandTestSub1Command.js";
import {MacroCommandTestSub2Command} from "./MacroCommandTestSub2Command.js";
+
/**
* A MacroCommand subclass used by MacroCommandTest.
*
diff --git a/test/patterns/command/MacroCommandTestSub1Command.js b/test/patterns/command/MacroCommandTestSub1Command.js
index 296611d..54f7121 100644
--- a/test/patterns/command/MacroCommandTestSub1Command.js
+++ b/test/patterns/command/MacroCommandTestSub1Command.js
@@ -1,3 +1,11 @@
+//
+// MacroCommandTestSub1Command.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {SimpleCommand} from "../../../src/index.js";
/**
diff --git a/test/patterns/command/MacroCommandTestSub2Command.js b/test/patterns/command/MacroCommandTestSub2Command.js
index a446761..ec301f0 100644
--- a/test/patterns/command/MacroCommandTestSub2Command.js
+++ b/test/patterns/command/MacroCommandTestSub2Command.js
@@ -1,3 +1,11 @@
+//
+// MacroCommandTestSub2Command.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {SimpleCommand} from "../../../src/index.js";
/**
diff --git a/test/patterns/command/MacroCommandTestVO.js b/test/patterns/command/MacroCommandTestVO.js
index a73450f..a9bea83 100644
--- a/test/patterns/command/MacroCommandTestVO.js
+++ b/test/patterns/command/MacroCommandTestVO.js
@@ -1,3 +1,11 @@
+//
+// MacroCommandTestVO.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
/**
* A utility class used by MacroCommandTest.
*
diff --git a/test/patterns/command/SimpleCommandTest.js b/test/patterns/command/SimpleCommandTest.js
index 470d90f..5ce5623 100644
--- a/test/patterns/command/SimpleCommandTest.js
+++ b/test/patterns/command/SimpleCommandTest.js
@@ -1,3 +1,11 @@
+//
+// SimpleCommandTest.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import chai from "chai"
import {Notification} from "../../../src/index.js"
import {SimpleCommandTestCommand} from "./SimpleCommandTestCommand.js";
diff --git a/test/patterns/command/SimpleCommandTestCommand.js b/test/patterns/command/SimpleCommandTestCommand.js
index 6667c9e..83f93be 100644
--- a/test/patterns/command/SimpleCommandTestCommand.js
+++ b/test/patterns/command/SimpleCommandTestCommand.js
@@ -1,3 +1,11 @@
+//
+// SimpleCommandTestCommand.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {SimpleCommand} from "../../../src/index.js";
/**
diff --git a/test/patterns/command/SimpleCommandTestVO.js b/test/patterns/command/SimpleCommandTestVO.js
index 3dae0d2..4119c42 100644
--- a/test/patterns/command/SimpleCommandTestVO.js
+++ b/test/patterns/command/SimpleCommandTestVO.js
@@ -1,3 +1,11 @@
+//
+// SimpleCommandTestVO.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
/**
* A utility class used by SimpleCommandTest.
*
diff --git a/test/patterns/facade/FacadeTest.js b/test/patterns/facade/FacadeTest.js
index f806fab..a975267 100644
--- a/test/patterns/facade/FacadeTest.js
+++ b/test/patterns/facade/FacadeTest.js
@@ -1,3 +1,11 @@
+//
+// FacadeTest.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import chai from "chai"
import {Facade, Mediator, Proxy} from "../../../src/index.js";
import {FacadeTestCommand} from "./FacadeTestCommand.js";
@@ -187,7 +195,7 @@ describe("FacadeTest", () => {
*/
it("should testHasCommand", () => {
// register the ControllerTestCommand to handle 'hasCommandTest' notes
- let facade = Facade.getInstance("FacadeTestKey10", key => new Facade(key));
+ let facade = Facade.getInstance("FacadeTestKey9", key => new Facade(key));
facade.registerCommand("facadeHasCommandTest", () => new FacadeTestCommand());
// test that hasCommand returns true for hasCommandTest notifications
@@ -205,19 +213,19 @@ describe("FacadeTest", () => {
*/
it("should testHasCoreAndRemoveCore", () => {
// assert that the Facade.hasCore method returns false first
- chai.assert.isFalse(Facade.hasCore("FacadeTestKey11"), "Expecting facade.hasCore('FacadeTestKey11') == false");
+ chai.assert.isFalse(Facade.hasCore("FacadeTestKey10"), "Expecting facade.hasCore('FacadeTestKey11') == false");
// register a Core
- Facade.getInstance("FacadeTestKey11", key => new Facade(key));
+ Facade.getInstance("FacadeTestKey10", key => new Facade(key));
// assert that the Facade.hasCore method returns true now that a Core is registered
- chai.assert.isTrue(Facade.hasCore("FacadeTestKey11"), "Expecting facade.hasCore('FacadeTestKey11') == true");
+ chai.assert.isTrue(Facade.hasCore("FacadeTestKey10"), "Expecting facade.hasCore('FacadeTestKey11') == true");
// remove the Core
- Facade.removeCore("FacadeTestKey11");
+ Facade.removeCore("FacadeTestKey10");
// assert that the Facade.hasCore method returns false now that the core has been removed.
- chai.assert.isFalse(Facade.hasCore("FacadeTestKey11"), "Expecting facade.hasCore('FacadeTestKey11') == false");
+ chai.assert.isFalse(Facade.hasCore("FacadeTestKey10"), "Expecting facade.hasCore('FacadeTestKey11') == false");
});
});
diff --git a/test/patterns/facade/FacadeTestCommand.js b/test/patterns/facade/FacadeTestCommand.js
index 0e76e6c..40f9c22 100644
--- a/test/patterns/facade/FacadeTestCommand.js
+++ b/test/patterns/facade/FacadeTestCommand.js
@@ -1,3 +1,11 @@
+//
+// FacadeTestCommand.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {SimpleCommand} from "../../../src/index.js";
/**
diff --git a/test/patterns/facade/FacadeTestVO.js b/test/patterns/facade/FacadeTestVO.js
index 43fb902..69ac636 100644
--- a/test/patterns/facade/FacadeTestVO.js
+++ b/test/patterns/facade/FacadeTestVO.js
@@ -1,3 +1,11 @@
+//
+// FacadeTestVO.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
/**
* A utility class used by FacadeTest.
*
diff --git a/test/patterns/mediator/MediatorTest.js b/test/patterns/mediator/MediatorTest.js
index d6e1ff1..3b33f7e 100644
--- a/test/patterns/mediator/MediatorTest.js
+++ b/test/patterns/mediator/MediatorTest.js
@@ -1,3 +1,11 @@
+//
+// MediatorTest.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import {Mediator} from "../../../src/index.js";
import chai from "chai"
diff --git a/test/patterns/observer/NotificationTest.js b/test/patterns/observer/NotificationTest.js
index 091d0f9..d8c4849 100644
--- a/test/patterns/observer/NotificationTest.js
+++ b/test/patterns/observer/NotificationTest.js
@@ -1,3 +1,11 @@
+//
+// NotificationTest.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import chai from "chai"
import {Notification} from "../../../src/index.js";
diff --git a/test/patterns/observer/NotifierTest.js b/test/patterns/observer/NotifierTest.js
index cb97510..87fbfa4 100644
--- a/test/patterns/observer/NotifierTest.js
+++ b/test/patterns/observer/NotifierTest.js
@@ -1,3 +1,11 @@
+//
+// NotifierTest.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import chai from "chai"
import {Facade, Notifier} from "../../../src/index.js";
import {FacadeTestVO} from "../facade/FacadeTestVO.js";
diff --git a/test/patterns/observer/ObserverTest.js b/test/patterns/observer/ObserverTest.js
index b504a6f..89cb966 100644
--- a/test/patterns/observer/ObserverTest.js
+++ b/test/patterns/observer/ObserverTest.js
@@ -1,3 +1,11 @@
+//
+// ObserverTest.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import chai from "chai"
import {Notification, Observer} from "../../../src/index.js";
@@ -79,9 +87,7 @@ describe("ObserverTest", () => {
it("should testCompareNotifyContext", () => {
// Create observer passing in notification method and context
let obj = {
- observerTestMethod: (notification) => {
-
- }
+ observerTestMethod: (notification) => {}
};
let observer = new Observer(obj.observerTestMethod, obj);
diff --git a/test/patterns/proxy/ProxyTest.js b/test/patterns/proxy/ProxyTest.js
index 12d814e..bf4928f 100644
--- a/test/patterns/proxy/ProxyTest.js
+++ b/test/patterns/proxy/ProxyTest.js
@@ -1,3 +1,11 @@
+//
+// ProxyTest.js
+// PureMVC JavaScript Multicore
+//
+// Copyright(c) 2023 Saad Shams
+// Your reuse is governed by the BSD-3-Clause License
+//
+
import chai from "chai"
import {Proxy} from "../../../src/index.js";
@@ -25,6 +33,9 @@ describe("ProxyTest", () => {
chai.assert.isTrue(proxy2.proxyName === Proxy.NAME, "Expecting proxy.getProxyName() == 'Proxy'");
});
+ /**
+ * Tests setting and getting the data using Proxy class accessor methods.
+ */
it("should testDataAccessors", () => {
// Create a new Proxy and use accessors to set the data
let proxy = new Proxy("colors", null);
@@ -38,6 +49,9 @@ describe("ProxyTest", () => {
chai.assert.equal(data[2], "blue", "Expecting data[2] == 'blue'");
});
+ /**
+ * Tests setting the name and body using the Notification class Constructor.
+ */
it("should testConstructor", () => {
// Create a new Proxy using the Constructor to set the name and data
let proxy = new Proxy("colors", ["red", "green", "blue"]);
From e7cf798b22d92f612f70c37ae4bc11e2d0b45e55 Mon Sep 17 00:00:00 2001
From: Saad
Date: Wed, 4 Sep 2024 21:23:11 -0400
Subject: [PATCH 4/6] update
Deployment to npm
removed bin from package.json
---
.github/workflows/node.js.yml | 12 +++++++++---
README.md | 2 +-
VERSION | 5 +++--
package.json | 5 +----
4 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index cd38f5c..038d522 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -5,9 +5,9 @@ name: Node.js CI
on:
push:
- branches: [ "master", "develop" ]
+ branches: [ "master" ]
pull_request:
- branches: [ "master", "develop" ]
+ branches: [ "master" ]
jobs:
build:
@@ -25,10 +25,16 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- cache: 'npm'
+ cache: "npm"
- run: npm install
- run: npm run build
- run: npm test
- run: sudo apt-get install xvfb
- run: xvfb-run --auto-servernum npm run test:chrome
- run: xvfb-run --auto-servernum npm run test:firefox
+
+ - name: Publish to npm
+ if: github.ref == 'refs/heads/master' && github.event_name == 'push'
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+ run: npm publish
diff --git a/README.md b/README.md
index fcc968b..788d839 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ npm install @puremvc/puremvc-js-multicore-framework
* [React Native](https://en.wikipedia.org/wiki/React_Native)
## Status
-Production - [Version 2.0.7](https://github.com/PureMVC/puremvc-js-multicore-framework/blob/master/VERSION)
+Production - [Version 2.0.8](https://github.com/PureMVC/puremvc-js-multicore-framework/blob/master/VERSION)
#### Documentation
- https://jsdoc.app/about-commandline.html
diff --git a/VERSION b/VERSION
index 654b7bd..adeb862 100644
--- a/VERSION
+++ b/VERSION
@@ -1,10 +1,10 @@
PureMVC MultiCore Framework for JavaScript
--------------------------------------------------------------------------
-Release Date: 8/14/24
+Release Date: 9/4/24
Platform: JavaScript
Version: 2
Revision: 0
- Minor: 7
+ Minor: 8
Authors: Saad Shams
: David Foley
: Cliff Hall
@@ -17,3 +17,4 @@ Release Date: 8/14/24
2.0.5 - NPM package borked for cjs
2.0.6 - NPM package bundling the ESM/CommonJS support
2.0.7 - Finally? NPM bundling
+2.0.8 - CI/CD Pipeline
diff --git a/package.json b/package.json
index bf4fe0c..3c5d9a3 100755
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@puremvc/puremvc-js-multicore-framework",
- "version": "2.0.7",
+ "version": "2.0.8",
"description": "PureMVC MultiCore Framework for JavaScript",
"type": "module",
"main": "bin/cjs/index.cjs",
@@ -11,9 +11,6 @@
"import": "./bin/esm/index.js"
}
},
- "bin": {
- "puremvc-js-multicore-framework": "bin/esm/index.js"
- },
"scripts": {
"build": "npm run clean && npm run build:lib",
"build:lib": "rollup -c build/rollup.conf.mjs",
From 4b7f75f825e8a16c82f86804c3b8ea07297d5030 Mon Sep 17 00:00:00 2001
From: Saad
Date: Fri, 6 Sep 2024 20:45:56 -0400
Subject: [PATCH 5/6] npm command
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 788d839..71a3286 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ PureMVC is a lightweight framework for creating applications based upon the clas
## Installation
```shell
-npm install @puremvc/puremvc-js-multicore-framework
+npm i @puremvc/puremvc-js-multicore-framework
```
## Demos
From 62770234787c257534351ade8bc16c4d26beb8c6 Mon Sep 17 00:00:00 2001
From: Saad
Date: Fri, 13 Sep 2024 13:44:21 -0400
Subject: [PATCH 6/6] update
removed matrix strategy
---
.github/workflows/node.js.yml | 39 +++++++++++++++--------------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index 038d522..9763c7b 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -14,27 +14,22 @@ jobs:
runs-on: ubuntu-latest
- strategy:
- matrix:
- node-version: [19.x, 20.x, 21.x]
- # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
-
steps:
- - uses: actions/checkout@v3
- - name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
- with:
- node-version: ${{ matrix.node-version }}
- cache: "npm"
- - run: npm install
- - run: npm run build
- - run: npm test
- - run: sudo apt-get install xvfb
- - run: xvfb-run --auto-servernum npm run test:chrome
- - run: xvfb-run --auto-servernum npm run test:firefox
+ - uses: actions/checkout@v3
+ - name: Use Node.js 20.x
+ uses: actions/setup-node@v3
+ with:
+ node-version: "20.x"
+ cache: "npm"
+ - run: npm install
+ - run: npm run build
+ - run: npm test
+ - run: sudo apt-get install xvfb
+ - run: xvfb-run --auto-servernum npm run test:chrome
+ - run: xvfb-run --auto-servernum npm run test:firefox
- - name: Publish to npm
- if: github.ref == 'refs/heads/master' && github.event_name == 'push'
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm publish
+ - name: Publish to npm
+ if: github.ref == 'refs/heads/master' && github.event_name == 'push'
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+ run: npm publish