@ribajs/extras
Advanced tools
Comparing version 1.9.0-alpha.2 to 1.9.0-alpha.10
{ | ||
"name": "@ribajs/extras", | ||
"description": "Extras module for Riba.js", | ||
"version": "1.9.0-alpha.2", | ||
"version": "1.9.0-alpha.10", | ||
"author": "Pascal Garber <pascal@artandcode.studio>", | ||
@@ -31,26 +31,26 @@ "contributors": [], | ||
"devDependencies": { | ||
"@babel/cli": "^7.10.5", | ||
"@babel/core": "^7.10.5", | ||
"@babel/cli": "^7.11.6", | ||
"@babel/core": "^7.11.6", | ||
"@babel/plugin-proposal-class-properties": "^7.10.4", | ||
"@babel/plugin-proposal-export-default-from": "^7.10.4", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.10.4", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.11.0", | ||
"@babel/plugin-syntax-dynamic-import": "^7.8.3", | ||
"@babel/preset-env": "^7.10.4", | ||
"@babel/preset-env": "^7.11.5", | ||
"@babel/preset-typescript": "^7.10.4", | ||
"@babel/runtime-corejs3": "^7.10.5", | ||
"@ribajs/eslint-config": "1.9.0-alpha.2", | ||
"@types/jest": "^26.0.4", | ||
"@typescript-eslint/eslint-plugin": "^3.6.1", | ||
"@typescript-eslint/parser": "^3.6.1", | ||
"@babel/runtime-corejs3": "^7.11.2", | ||
"@ribajs/eslint-config": "1.9.0-alpha.10", | ||
"@types/jest": "^26.0.13", | ||
"@typescript-eslint/eslint-plugin": "^3.10.1", | ||
"@typescript-eslint/parser": "^3.10.1", | ||
"babel-loader": "^8.1.0", | ||
"babel-plugin-array-includes": "^2.0.3", | ||
"core-js": "^3.6.5", | ||
"eslint": "^7.4.0", | ||
"eslint": "^7.8.1", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"jest": "^26.1.0", | ||
"jest": "^26.4.2", | ||
"jest-extended": "^0.11.5", | ||
"prettier": "^2.0.5", | ||
"ts-jest": "^26.1.3", | ||
"typescript": "^3.9.7", | ||
"prettier": "^2.1.1", | ||
"ts-jest": "^26.3.0", | ||
"typescript": "^4.0.2", | ||
"webpack": "^5.0.0-beta.22", | ||
@@ -60,4 +60,4 @@ "webpack-cli": "^3.3.12" | ||
"dependencies": { | ||
"@ribajs/core": "1.9.0-alpha.2", | ||
"@ribajs/utils": "1.9.0-alpha.2" | ||
"@ribajs/core": "1.9.0-alpha.10", | ||
"@ribajs/utils": "1.9.0-alpha.10" | ||
}, | ||
@@ -64,0 +64,0 @@ "bugs": { |
@@ -14,4 +14,5 @@ # Extras Module | ||
```ts | ||
import { Riba, coreModule, Utils } from '@ribajs/core'; | ||
import { JQuery, extrasModule } from '@ribajs/extras'; | ||
import { Riba, coreModule } from '@ribajs/core'; | ||
import { extrasModule } from '@ribajs/extras'; | ||
import { ready } from '@ribajs/utils/src/dom'; | ||
const riba = new Riba(); | ||
@@ -21,5 +22,5 @@ const model = {}; | ||
riba.module.regist(extrasModule); | ||
Utils.domIsReady(() => { | ||
ready(() => { | ||
riba.bind(document.body, model); | ||
}); | ||
``` |
import { Binder } from "@ribajs/core"; | ||
import { throttle } from "@ribajs/utils/src/control"; | ||
@@ -13,17 +14,7 @@ /** | ||
bind() { | ||
if (!this.customData) { | ||
this.customData = { | ||
handler: null, | ||
}; | ||
} | ||
/**/ | ||
}, | ||
unbind(el: HTMLElement) { | ||
if (this.customData.handler) { | ||
if (this.args === null) { | ||
throw new Error("args is null"); | ||
} | ||
const eventName = this.args[0] as string; | ||
el.removeEventListener(eventName, this.customData.handler); | ||
} | ||
unbind(/*el: HTMLElement*/) { | ||
/**/ | ||
}, | ||
@@ -36,6 +27,2 @@ | ||
if (this.customData.handler) { | ||
window.removeEventListener("resize", this.customData.handler); | ||
} | ||
const propertyName = this.args[0] as string; | ||
@@ -47,11 +34,17 @@ const elementToSync = document.getElementById(value); | ||
el.style.height = elementToSync.clientHeight + "px"; | ||
window.addEventListener("resize", () => { | ||
el.style.height = elementToSync.clientHeight + "px"; | ||
}); | ||
window.addEventListener( | ||
"resize", | ||
throttle(() => { | ||
el.style.height = elementToSync.clientHeight + "px"; | ||
}) | ||
); | ||
break; | ||
case "width": | ||
el.style.width = elementToSync.clientWidth + "px"; | ||
window.addEventListener("resize", () => { | ||
el.style.width = elementToSync.clientWidth + "px"; | ||
}); | ||
window.addEventListener( | ||
"resize", | ||
throttle(() => { | ||
el.style.width = elementToSync.clientWidth + "px"; | ||
}) | ||
); | ||
break; | ||
@@ -58,0 +51,0 @@ default: |
@@ -13,3 +13,1 @@ import { RibaModule } from "@ribajs/core"; | ||
}; | ||
export default extrasModule; |
export * from "./services"; | ||
export * from "./binders"; | ||
export * from "./types"; | ||
export * from "./extras.module"; | ||
export { extrasModule } from "./extras.module"; |
import { Utils as ExtraUtils } from "./utils.service"; | ||
import { Gameloop } from "./gameloop.service"; | ||
import { throttle, debounce } from "@ribajs/utils/src/control"; | ||
@@ -195,8 +196,14 @@ export interface AutoscrollOptions { | ||
protected onResize() { | ||
this.limit = this.getLimit(this.el); | ||
this.resume(200); | ||
throttle(() => { | ||
this.limit = this.getLimit(this.el); | ||
this.resume(200); | ||
})(); | ||
} | ||
protected onScroll() { | ||
this.stopResumeTimeout(); | ||
throttle(() => { | ||
debounce(() => { | ||
this.stopResumeTimeout(); | ||
})(); | ||
})(); | ||
} | ||
@@ -203,0 +210,0 @@ |
import { Utils } from "./utils.service"; | ||
import { throttle } from "@ribajs/utils/src/control"; | ||
@@ -75,8 +76,8 @@ export interface DragscrollOptions { | ||
public checkDraggable() { | ||
if (Utils.isScrollable(this.el)) { | ||
this.el.classList.add("draggable"); | ||
return true; | ||
} | ||
this.el.classList.remove("draggable"); | ||
return false; | ||
return throttle(() => { | ||
if (Utils.isScrollable(this.el)) { | ||
this.el.classList.add("draggable"); | ||
} | ||
this.el.classList.remove("draggable"); | ||
})(); | ||
} | ||
@@ -83,0 +84,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5635
25
187180
+ Added@ribajs/core@1.9.0-alpha.10(transitive)
+ Added@ribajs/utils@1.9.0-alpha.10(transitive)
- Removed@ribajs/core@1.9.0-alpha.2(transitive)
- Removed@ribajs/utils@1.9.0-alpha.2(transitive)
Updated@ribajs/core@1.9.0-alpha.10
Updated@ribajs/utils@1.9.0-alpha.10