@cordisjs/core
Advanced tools
Comparing version 3.13.0 to 3.13.1
@@ -338,3 +338,3 @@ import { Awaitable, Promisify, Dict } from 'cosmokit'; | ||
get(name: string): any; | ||
set(name: string, value: any): void; | ||
set(name: string, value: any): () => void; | ||
provide(name: string, value?: any, builtin?: boolean): void; | ||
@@ -341,0 +341,0 @@ accessor(name: string, options: Omit<Context.Internal.Accessor, 'type'>): void; |
{ | ||
"name": "@cordisjs/core", | ||
"description": "Meta-Framework for Modern JavaScript Applications", | ||
"version": "3.13.0", | ||
"version": "3.13.1", | ||
"sideEffects": false, | ||
@@ -6,0 +6,0 @@ "type": "module", |
@@ -141,3 +141,3 @@ import { defineProperty, Dict, isNullable } from 'cosmokit' | ||
} else { | ||
ctx.emit('internal/warning', new Error(`Assigning to service ${name} is not recommended, please use \`ctx.set()\` method instead`)) | ||
ctx.emit('internal/warning', new Error(`assigning to service ${name} is not recommended, please use \`ctx.set()\` method instead`)) | ||
ctx.set(name, value) | ||
@@ -233,3 +233,4 @@ return true | ||
value ??= undefined | ||
if (oldValue === value) return | ||
let dispose = () => {} | ||
if (oldValue === value) return dispose | ||
@@ -242,3 +243,5 @@ // check override | ||
if (!isNullable(value)) { | ||
ctx.on('dispose', () => ctx.set(name, undefined)) | ||
dispose = ctx.effect(() => () => { | ||
ctx.set(name, undefined) | ||
}) | ||
} | ||
@@ -261,2 +264,3 @@ if (isUnproxyable(value)) { | ||
ctx.emit(self, 'internal/service', name, oldValue) | ||
return dispose | ||
} | ||
@@ -263,0 +267,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
200900
3636