Skip to content

Commit e2d0101

Browse files
committed
chore!: support removal of once from Function prototype
1 parent 4e889d4 commit e2d0101

File tree

7 files changed

+17
-8
lines changed

7 files changed

+17
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ Changelog
1111
1212
_Note: Gaps between patch versions are faulty, broken or test releases._
1313

14+
## v4.0.0-beta.172 (2024-12-25)
15+
16+
#### :boom: Breaking Change
17+
18+
* Updated `@v4fire/core` to version `4.0.0-alpha.54` with removal of `once` from `Function` prototype
19+
1420
## v4.0.0-beta.171 (2024-12-23)
1521

1622
#### :house: Internal

src/components/directives/bind-with/interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* https://github.com/V4Fire/Client/blob/master/LICENSE
77
*/
88

9-
import type { EventEmitterLike, PromiseLikeP } from 'core/async';
9+
import type { EventEmitterLikeP, PromiseLikeP } from 'core/async';
1010

1111
import type { DirectiveBinding } from 'core/component/engines';
1212
import type { WatchOptions } from 'core/component/interface';
@@ -62,7 +62,7 @@ export interface EventListener<A extends any[]> extends Handle<A> {
6262
/**
6363
* An event emitter to listen
6464
*/
65-
emitter?: EventEmitterLike | EventEmitterLike['on'];
65+
emitter?: EventEmitterLikeP;
6666

6767
/**
6868
* The event name to listen for, or a list of such events

src/components/directives/bind-with/test/unit/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ test.describe('components/directives/bind-with', () => {
4747
const el = await renderDirective(page, {
4848
emitter: (event: string, listener: AnyFunction) => {
4949
document.body.addEventListener(event, listener);
50+
return undefined;
5051
},
5152

5253
on: 'testEvent'

src/components/super/i-block/base/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ export default abstract class iBlockBase extends iBlockFriends {
519519
// eslint-disable-next-line prefer-const
520520
unwatch: Nullable<Function>;
521521

522-
const emitter: Function = (_: any, wrappedHandler: RawWatchHandler<typeof that, T>) => {
522+
const emitter = (_: any, wrappedHandler: RawWatchHandler<typeof that, T>) => {
523523
wrappedHandler['originalLength'] = handler['originalLength'] ?? handler.length;
524524
handler = wrappedHandler;
525525

src/core/component/engines/vue3/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function getComponent(meta: ComponentMeta): ComponentOptions<typeof Compo
6767
unsafe.$vueWatch = this.$watch.bind(this);
6868
init.beforeDataCreateState(ctx);
6969

70-
const emitter: Function = (_: unknown, handler: WatchHandler) => {
70+
const emitter = (_: unknown, handler: WatchHandler) => {
7171
// eslint-disable-next-line @v4fire/unbound-method
7272
const {unwatch} = watch(unsafe.$fields, {deep: true, immediate: true}, handler);
7373
return unwatch;

src/core/component/init/states/before-create.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Async from 'core/async';
1010

1111
import * as gc from 'core/component/gc';
1212
import watch from 'core/object/watch';
13+
import { once } from 'core/functools';
1314

1415
import { V4_COMPONENT } from 'core/component/const';
1516
import { getComponentContext } from 'core/component/context';
@@ -121,7 +122,7 @@ export function beforeCreateState(
121122

122123
let fn = () => ('getRoot' in ctx ? ctx.getRoot?.() : null) ?? ctx.$root;
123124

124-
fn = fn.once();
125+
fn = once(fn);
125126

126127
Object.defineProperty(ctx, $getRoot, {
127128
configurable: true,
@@ -163,7 +164,7 @@ export function beforeCreateState(
163164
return targetCtx[$getParent];
164165
}
165166

166-
let fn: CanUndef<Function>;
167+
let fn: CanUndef<AnyFunction>;
167168

168169
if (restArgs != null) {
169170
// VNODE
@@ -179,7 +180,7 @@ export function beforeCreateState(
179180
fn = () => ctx;
180181
}
181182

182-
fn = fn.once();
183+
fn = once(fn);
183184

184185
Object.defineProperty(targetCtx, $getParent, {
185186
configurable: true,

src/core/init/dependencies/helpers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* https://github.com/V4Fire/Client/blob/master/LICENSE
77
*/
88

9+
import { once } from 'core/functools';
910
import type { DependencyFn, Dependency } from 'core/init/dependencies/interface';
1011

1112
/**
@@ -137,7 +138,7 @@ export function* createDependencyIterator(
137138
wait: expandedWait
138139
};
139140

140-
expandedDependency.fn = expandedDependency.fn.once();
141+
expandedDependency.fn = once(expandedDependency.fn);
141142
expandedDependencies.set(dependency, expandedDependency);
142143

143144
return expandedDependency;

0 commit comments

Comments
 (0)