@unsetsoft/ryunixjs 0.1.2-alpha.1 → 0.1.3-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/hooks.js ADDED
@@ -0,0 +1,5 @@
1
+ const useLoaded = (fn) => {
2
+ return document.addEventListener("DOMContentLoaded", fn);
3
+ };
4
+
5
+ export { useLoaded };
package/lib/reconciler.js CHANGED
@@ -6,6 +6,7 @@ export function render(element, parentDom) {
6
6
  const nextInstance = reconcile(parentDom, prevInstance, element);
7
7
  rootInstance = nextInstance;
8
8
  }
9
+
9
10
  export function reconcile(parentDom, instance, element) {
10
11
  if (instance === null) {
11
12
  const newInstance = instantiate(element);
package/lib/ryunix.js CHANGED
@@ -1,11 +1,10 @@
1
1
  import { render } from "./reconciler";
2
2
  import { createElement } from "./element";
3
3
  import { Component } from "./component";
4
- import hooks from "./hooks/index.js";
5
- export { createElement, render, Component, hooks };
4
+ import { useLoaded } from "./hooks";
5
+ export { createElement, render, Component, useLoaded };
6
6
  export default {
7
7
  render,
8
8
  createElement,
9
9
  Component,
10
- hooks,
11
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsetsoft/ryunixjs",
3
- "version": "0.1.2-alpha.1",
3
+ "version": "0.1.3-alpha.1",
4
4
  "license": "MIT",
5
5
  "main": "./dist/Ryunix.js",
6
6
  "private": false,
@@ -1,3 +0,0 @@
1
- import Store from "./store";
2
- const useStore = (val) => new Store(val).hook();
3
- export default { useStore };
@@ -1,20 +0,0 @@
1
- class Store {
2
- constructor(defvalue) {
3
- this.defvalue = defvalue;
4
- }
5
- /* `setValue` is a method that takes in a parameter `newValue`. The arrow function syntax `=>` is
6
- used to define the function. Inside the function, the `defvalue` property of the `Store` instance
7
- is set to the `newValue` parameter. This means that when `setValue` is called with a new value, it
8
- updates the `defvalue` property of the `Store` instance to that new value. */
9
- setValue = (newValue) => (this.defvalue = newValue);
10
-
11
- /* `hook` is a method that returns an array containing two functions: `getValue` and `setValue`.
12
- These functions can be used to get and set the value of the `defvalue` property of the `Store`
13
- class instance. This is useful for implementing state management in React functional components
14
- using the `useState` hook. */
15
- hook = () => {
16
- return [this.defvalue, this.setValue];
17
- };
18
- }
19
-
20
- export default Store;