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.2.14 to 1.2.15

8

demonstrament/documents/static-cms/control.js

@@ -53,7 +53,11 @@ import { Control } from '/dependencies/mvc-framework.js'

},
events: {},
events: {
"routers.location.default route": ($event) => {
console.log($event)
}
},
}, {
defineProperties: {
start: { value: function () {
// console.log(this.models.default.parse())
console.log(this.models.default.parse())
// this.views.default.render(this.models.default.parse(), 'default')

@@ -60,0 +64,0 @@ // console.log(this.views.default.querySelectors)

import { Control } from '/dependencies/mvc-framework.js'
import ControlParameters from './control.js'
const control = new Control(...ControlParameters)
console.log(control)
/*
document.addEventListener('DOMContentLoaded', ($event) => {
control.start()
}, { once: true })
*/

@@ -13,11 +13,2 @@ import { recursiveAssign } from '../../Coutil/index.js'

#_boundPopState
// Window Location Properties
#_protocol
#_hostname
#_port
#_origin
#_pathname
#_hash
#_search
#_href
constructor($settings, $options) {

@@ -28,4 +19,4 @@ super(

)
this.#popState()
this.enableEvents()
this.#popState()
}

@@ -71,113 +62,4 @@ get window() {

}
// Window Location Properties
get protocol() {
if(this.#_protocol !== undefined) return this.#_protocol
this.#_protocol = this.window.location.protocol
return this.#_protocol
}
set protocol($protocol) {
if($protocol !== this.#_protocol) {
this.#_protocol = $protocol
}
}
get hostname() {
if(this.#_hostname !== undefined) return this.#_hostname
this.#_hostname = this.window.location.hostname
return this.#_hostname
}
set hostname($hostname) {
if($hostname !== this.#_hostname) {
this.#_hostname = $hostname
}
}
get port() {
if(this.#_port !== undefined) return this.#_port
this.#_port = this.window.location.port
return this.#_port
}
set port($port) {
if($port !== this.#_port) {
this.#_port = $port
}
}
get origin() {
if(this.#_origin !== undefined) return this.#_origin
this.#_origin = this.window.location.origin
return this.#_origin
}
set origin($origin) {
if($origin !== this.#_origin) {
this.#_origin = $origin
}
}
get pathname() {
if(this.#_pathname !== undefined) return this.#_pathname
this.#_pathname = this.window.location.pathname
return this.#_pathname
}
set pathname($pathname) {
if($pathname !== this.#_pathname) {
const preter = this.#_pathname
const anter = $pathname
this.#_pathname = anter
this.dispatchEvent(
new RouteEvent("route:pathname", {
detail: { preter, anter }
}, this)
)
}
}
get hash() {
if(this.#_hash !== undefined) return this.#_hash
this.#_hash = this.window.location.hash
return this.#_hash
}
set hash($hash) {
if($hash !== this.#_hash) {
const preter = this.#_hash
const anter = $hash
this.#_hash = anter
this.dispatchEvent(
new RouteEvent("route:hash", {
detail: { preter, anter }
}, this)
)
}
}
get search() {
if(this.#_search !== undefined) return this.#_search
this.#_search = this.window.location.search
return this.#_search
}
set search($search) {
if($search !== this.#_search) {
const preter = this.#_search
const anter = $search
this.#_search = anter
this.dispatchEvent(
new RouteEvent("route:search", {
detail: { preter, anter }
}, this)
)
}
}
get href() {
if(this.#_href !== undefined) return this.#_href
this.#_href = this.window.location.href
return this.#_href
}
set href($href) {
if($href !== this.#_href) {
const preter = this.#_href
const anter = $href
this.#_href = anter
this.dispatchEvent(
new RouteEvent("route:href", {
detail: { preter, anter }
}, this)
)
}
}
// Methods
#popState() {
#popState($event = {}) {
const preterRoute = this.activeRoute

@@ -190,16 +72,5 @@ if(preterRoute) preterRoute.active = false

route.active = true
this.protocol = this.window.location.protocol
this.hostname = this.window.location.hostname
this.port = this.window.location.port
this.pathname = this.window.location.pathname
this.hash = this.window.location.hash
this.search = this.window.location.search
this.href = this.window.location.href
route.state = $event?.state
this.dispatchEvent(
new RouteEvent("route", {
detail: {
preterRoute,
anterRoute: route,
}
}, this)
new RouteEvent("route", { route })
)

@@ -241,4 +112,12 @@ }

const [$routePath, $route] = routeEntries[routeEntryIndex]
if($route.match($path)) {
route = $route
const routeMatch = $route.match($path)
if(routeMatch) {
route = Object.entries(Object.getOwnPropertyDescriptors($route))
.reduce(($propertyDescriptors, [$key, $descriptor]) => {
$propertyDescriptors[$key] = $descriptor.value
return $propertyDescriptors
}, {
enable: $route.enable
})
Object.assign(route, routeMatch)
break iterateMatchEntries

@@ -245,0 +124,0 @@ }

import { match } from '../../../node_modules/path-to-regexp/dist/index.js'
export default class Route extends EventTarget {
#settings
#_settings
#_enable

@@ -11,3 +11,9 @@ #_active

}
get name() { return this.#settings.name }
get #settings() { return this.#_settings }
set #settings($settings) {
this.#_settings = $settings
for(const [$settingKey, $settingVal] of Object.entries($settings)) {
Object.defineProperty(this, $settingKey, { value: $settingVal })
}
}
get basename() { return this.#settings.basename }

@@ -14,0 +20,0 @@ get enable() {

export default class RouteEvent extends Event {
#settings
#router
#_route
constructor($type, $settings, $router) {
constructor($type, $settings) {
super($type, $settings)
this.#settings = $settings
this.#router = $router
}
get detail() { return this.#settings.detail }
get protocol() { return this.#router.protocol }
get hostname() { return this.#router.hostname }
get port() { return this.#router.port }
get pathname() { return this.#router.pathname }
get hash() { return this.#router.hash }
get search() { return this.#router.search }
get href() { return this.#router.href }
get route() { return this.#settings.route }
}
{
"name": "js-mvc-framework",
"author": "Thomas Patrick Welborn",
"version": "1.2.14",
"version": "1.2.15",
"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