Socket
Socket
Sign inDemoInstall

@ribajs/core

Package Overview
Dependencies
Maintainers
2
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ribajs/core - npm Package Compare versions

Comparing version 1.9.0-beta.0 to 1.9.0-beta.1

10

package.json
{
"name": "@ribajs/core",
"description": "Core module of Riba.js",
"version": "1.9.0-beta.0",
"version": "1.9.0-beta.1",
"author": "Pascal Garber <pascal@artandcode.studio>",

@@ -52,5 +52,5 @@ "contributors": [

"@babel/runtime-corejs3": "^7.11.2",
"@ribajs/eslint-config": "1.9.0-beta.0",
"@ribajs/tsconfig": "1.9.0-beta.0",
"@ribajs/types": "1.9.0-beta.0",
"@ribajs/eslint-config": "1.9.0-beta.1",
"@ribajs/tsconfig": "1.9.0-beta.1",
"@ribajs/types": "1.9.0-beta.1",
"@types/core-js": "^2.5.3",

@@ -86,4 +86,4 @@ "@types/jest": "^26.0.13",

"dependencies": {
"@ribajs/utils": "1.9.0-beta.0"
"@ribajs/utils": "1.9.0-beta.1"
}
}

@@ -0,2 +1,4 @@

/* eslint-disable @typescript-eslint/no-this-alias */
import { Binder } from "../interfaces";
import { getInputValue } from "@ribajs/utils/src/dom";
import { getString } from "@ribajs/utils/src/type";

@@ -14,4 +16,22 @@

onChange() {
this.publish();
},
bind(el) {
el.addEventListener("change", this.publish);
const self = this;
this.customData = this.customData || {};
if (!this.customData.onChange) {
this.customData.onChange = () => {
self.publish();
};
}
el.addEventListener("change", this.customData.onChange, false);
// el.addEventListener("click", this.customData.onChange, false);
// el.addEventListener("input", this.customData.onChange, false);
// el.addEventListener("focus", this.customData.onChange, false);
// el.addEventListener("blur", this.customData.onChange, false);
(el as HTMLInputElement).checked = !!(el as HTMLInputElement).checked;

@@ -21,17 +41,22 @@ },

unbind(el) {
el.removeEventListener("change", this.publish);
el.removeEventListener(this.customData.event, this.customData.onChange);
// el.addEventListener("click", this.customData.onChange);
// el.addEventListener("input", this.customData.onChange);
// el.addEventListener("focus", this.customData.onChange);
// el.addEventListener("blur", this.customData.onChange);
},
routine(el: HTMLElement, value) {
routine(el: HTMLElement, newValue) {
const oldValue = this.getValue(el);
if ((el as HTMLInputElement).type === "radio") {
(el as HTMLInputElement).checked =
getString((el as HTMLInputElement).value) === getString(value);
getString(oldValue) === getString(newValue);
} else {
(el as HTMLInputElement).checked = !!value;
if (oldValue !== newValue) {
(el as HTMLInputElement).checked = !!newValue;
}
}
},
getValue(el) {
return !!(el as HTMLInputElement).checked;
},
getValue: getInputValue,
};

@@ -18,5 +18,5 @@ import { Binder } from "../interfaces";

} else {
(el.style as any)[propertyName] = value;
(el.style as any).setProperty(propertyName, value);
}
},
};

@@ -46,7 +46,8 @@ import { Binder } from "../interfaces";

if (!this.customData.event) {
this.customData.event = "change input keyup paste blur focus";
}
el.addEventListener(this.customData.event, this.customData.onChange);
el.addEventListener("change", this.customData.onChange, false);
el.addEventListener("input", this.customData.onChange, false);
el.addEventListener("keyup", this.customData.onChange, false);
el.addEventListener("paste", this.customData.onChange, false);
el.addEventListener("blur", this.customData.onChange, false);
el.addEventListener("focus", this.customData.onChange, false);
}

@@ -56,3 +57,8 @@ },

unbind(el: HTMLUnknownElement) {
el.removeEventListener(this.customData.event, this.customData.onChange);
el.removeEventListener("change", this.customData.onChange);
el.removeEventListener("input", this.customData.onChange);
el.removeEventListener("keyup", this.customData.onChange);
el.removeEventListener("paste", this.customData.onChange);
el.removeEventListener("blur", this.customData.onChange);
el.removeEventListener("focus", this.customData.onChange);
},

@@ -59,0 +65,0 @@

@@ -19,2 +19,1 @@ import { RibaModule } from "./interfaces";

export { coreModule };
export default coreModule;

@@ -154,3 +154,4 @@ import { concat } from "@ribajs/utils/src/type";

try {
resolve(JSON.parse(req.responseText));
const responseText = JSON.parse(req.responseText);
resolve(responseText);
} catch (error) {

@@ -157,0 +158,0 @@ // If json can't be parsed

@@ -164,3 +164,3 @@ import { Riba } from "./riba";

this.bindings.forEach((binding) => {
if (binding.binder && binding.publish && binding.binder.publishes) {
if (binding.binder && binding.binder.publishes && binding.publish) {
binding.publish();

@@ -167,0 +167,0 @@ }

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