@cfcs/react
Advanced tools
Comparing version 0.0.17 to 0.0.18
import { ReactiveSubscribe, ReactiveAdapter } from "@cfcs/core"; | ||
import { ReactReactiveResult } from "./types"; | ||
export declare function useReactive<Instance extends ReactiveSubscribe<Record<string, any>>, State extends Record<string, any> = {}, Methods extends keyof Partial<Instance> = any, Props = any, Events extends Record<string, any> = {}>(reactiveAdapter: ReactiveAdapter<Instance, State, Methods, Props, Events>): ReactReactiveResult<Instance, State, Methods, Events>; | ||
export declare function useReactive<Instance extends ReactiveSubscribe<Record<string, any>>, State extends Record<string, any> = {}, Methods extends keyof Partial<Instance> = any, Props = any, Events extends Record<string, any> = {}>(reactiveAdapter: ReactiveAdapter<Instance, State, Methods, Props, Events>, props?: () => Props): ReactReactiveResult<Instance, State, Methods, Events>; |
@@ -7,3 +7,3 @@ /* | ||
repository: https://github.com/naver/cfcs | ||
version: 0.0.17 | ||
version: 0.0.18 | ||
*/ | ||
@@ -15,5 +15,5 @@ 'use strict'; | ||
function useReactive(reactiveAdapter) { | ||
function useReactive(reactiveAdapter, props) { | ||
var adaptResult = react.useMemo(function () { | ||
return core.adaptReactive(reactiveAdapter); | ||
return core.adaptReactive(reactiveAdapter, props); | ||
}, []); | ||
@@ -68,3 +68,3 @@ var reactiveState = adaptResult.state(); | ||
}, {}); | ||
var reactiveEvents = reactiveAdapter.events || []; | ||
var reactiveEvents = adaptResult.events(); | ||
reactiveEvents.forEach(function (name) { | ||
@@ -71,0 +71,0 @@ result[core.camelize("on ".concat(name))] = function (callback, dependencies) { |
@@ -7,3 +7,3 @@ /* | ||
repository: https://github.com/naver/cfcs | ||
version: 0.0.17 | ||
version: 0.0.18 | ||
*/ | ||
@@ -13,5 +13,5 @@ import { adaptReactive, keys, camelize } from '@cfcs/core'; | ||
function useReactive(reactiveAdapter) { | ||
function useReactive(reactiveAdapter, props) { | ||
var adaptResult = useMemo(function () { | ||
return adaptReactive(reactiveAdapter); | ||
return adaptReactive(reactiveAdapter, props); | ||
}, []); | ||
@@ -66,3 +66,3 @@ var reactiveState = adaptResult.state(); | ||
}, {}); | ||
var reactiveEvents = reactiveAdapter.events || []; | ||
var reactiveEvents = adaptResult.events(); | ||
reactiveEvents.forEach(function (name) { | ||
@@ -69,0 +69,0 @@ result[camelize("on ".concat(name))] = function (callback, dependencies) { |
{ | ||
"name": "@cfcs/react", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"description": "Cross Framework Components", | ||
@@ -35,3 +35,3 @@ "main": "dist/cfcs.cjs.js", | ||
"dependencies": { | ||
"@cfcs/core": "~0.0.17" | ||
"@cfcs/core": "~0.0.18" | ||
}, | ||
@@ -38,0 +38,0 @@ "devDependencies": { |
@@ -12,4 +12,4 @@ import { ReactiveSubscribe, ReactiveAdapter, keys, camelize, adaptReactive } from "@cfcs/core"; | ||
Events extends Record<string, any> = {}, | ||
>(reactiveAdapter: ReactiveAdapter<Instance, State, Methods, Props, Events>): ReactReactiveResult<Instance, State, Methods, Events> { | ||
const adaptResult = useMemo(() => adaptReactive(reactiveAdapter), []); | ||
>(reactiveAdapter: ReactiveAdapter<Instance, State, Methods, Props, Events>, props?: () => Props): ReactReactiveResult<Instance, State, Methods, Events> { | ||
const adaptResult = useMemo(() => adaptReactive(reactiveAdapter, props), []); | ||
const reactiveState = adaptResult.state(); | ||
@@ -67,3 +67,3 @@ const names = keys<Record<string, any>>(reactiveState); | ||
const reactiveEvents = (reactiveAdapter.events || []); | ||
const reactiveEvents = adaptResult.events(); | ||
@@ -70,0 +70,0 @@ reactiveEvents.forEach(name => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
24953
Updated@cfcs/core@~0.0.18