Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-mvc-framework

Package Overview
Dependencies
Maintainers
0
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-mvc-framework - npm Package Compare versions

Comparing version 1.3.5 to 1.3.6

development/Model/ChangeEvent/index.js

4

demonstrament/documents/test/index.js

@@ -41,5 +41,5 @@ import { Model } from "/dependencies/mvc-framework.js"

// console.log(model.content.get("propertyA.propertyB").root)
model.save()
// model.save()
// console.log(model.localStorage.get())
model.unload()
// model.unload()
// console.log(model.localStorage.get())

@@ -46,0 +46,0 @@

@@ -8,3 +8,2 @@ export default {

enableEvents: true,
changeEvents: true,
pathkey: true,

@@ -11,0 +10,0 @@ subpathError: false,

@@ -8,3 +8,3 @@ import { recursiveAssign } from '../Coutil/index.js'

import Options from './Options/index.js'
import ContentEvent from './Content/Events/Content/index.js'
import ChangeEvent from './ChangeEvent/index.js'
const ChangeEvents = [

@@ -23,5 +23,3 @@ // Accessor

#_localStorage
#_change
#_changeEvents
#_boundPropertyChange
constructor($settings = {}, $options = {}) {

@@ -83,2 +81,3 @@ super(

if($changeEvents !== this.#_changeEvents) {
const boundPropertyChange = this.#propertyChange.bind(this)
this.#_changeEvents = $changeEvents

@@ -88,3 +87,3 @@ switch(this.#_changeEvents) {

for(const $eventType of ChangeEvents) {
this.content.addEventListener($eventType, this.#boundPropertyChange)
this.content.addEventListener($eventType, boundPropertyChange)
}

@@ -94,3 +93,3 @@ break

for(const $eventType of ChangeEvents) {
this.content.removeEventListener($eventType, this.#boundPropertyChange)
this.content.removeEventListener($eventType, boundPropertyChange)
}

@@ -102,11 +101,10 @@ break

}
get #boundPropertyChange() {
if(this.#_boundPropertyChange !== undefined) return this.#_boundPropertyChange
this.#_boundPropertyChange = this.#propertyChange.bind(this)
return this.#_boundPropertyChange
}
#propertyChange($event) {
let { type, path, key, value, detail } = $event
detail = Object.assign({ type }, detail)
this.save()
const { type, path, value } = $event
const detail = Object.assign({ type }, $event.detail)
const originalEvent = $event
this.dispatchEvent(
new ChangeEvent("change", { path, value, detail, originalEvent })
)
}

@@ -113,0 +111,0 @@ save() {

@@ -7,2 +7,3 @@ export default {

autosave: false, // Boolean
changeEvents: false, // Boolean
}

@@ -56,2 +56,8 @@ # Model Class

- Specifies `content` saved to `localStorage` after each content property modifier event.
### `changEvents` Options
**Default**: `false`
**Required**: `false`
**Type**: `Boolean`
**Descript**:
- Specifies `content` property modifier events (`ChangeEvents`) captured

@@ -61,2 +67,3 @@ ## `constructor` Method

## Public Properties

@@ -79,2 +86,11 @@ ### `schema` Property

**Descript**:
### `changeEvents` Property
**Type**: `get`, `set`
**Inturn**: `$changeEvents`
**Return**: `#_changeEvents`
**Descript**:
- When `$changeEvents` differs from `#_changeEvents` the new value is assigned.
- When `$changeEvents` is `true` an event listener is added to `content` for each `ChangeEvents` type.
- When `$changeEvents` is `falase` an event listener is removed from `content` for each `ChangeEvents` type.
## Public Methods

@@ -106,4 +122,5 @@ ### `save` Method

**Type**: `Content`, `null`
### `#_localStorage` property
### `#_localStorage` Property
**Type**: `LocalStorage`
### `#_changeEvents` Property
**Type**: `Boolean`
{
"name": "js-mvc-framework",
"author": "Thomas Patrick Welborn",
"version": "1.3.5",
"version": "1.3.6",
"type": "module",

@@ -6,0 +6,0 @@ "scripts": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc