bug fix; typing loadres (#4664)

This commit is contained in:
Leslie Leigh
2019-06-21 09:35:20 +08:00
committed by Weiliang Wang
parent 408cc6f930
commit fac20f8df1
4 changed files with 36 additions and 7 deletions
+7 -4
View File
@@ -437,10 +437,13 @@ export class AnimationComponent extends Component implements IEventTarget {
}
private _removeStateOfAutomaticClip (clip: AnimationClip) {
const state = this._nameToState[name];
if (state && equalClips(clip, state.clip)) {
state.stop();
delete this._nameToState[name];
// tslint:disable-next-line:forin
for (const name in this._nameToState) {
const state = this._nameToState[name];
if (equalClips(clip, state.clip)) {
state.stop();
delete this._nameToState[name];
}
}
}
+22
View File
@@ -38,6 +38,7 @@ import { callInNextTick } from '../core/utils/misc';
import AssetLoader from './asset-loader';
import AssetTable from './asset-table';
import { getDependsRecursively } from './auto-release-utils';
import { LoadCompleteCallback, LoadProgressCallback } from './callback-params';
import Downloader from './downloader';
import Loader from './loader';
import LoadingItems from './loading-items';
@@ -401,6 +402,27 @@ class CCLoader extends Pipeline {
return accepted;
}
public loadRes<T> (
url: string,
type: Constructor<T>,
mount: string,
progressCallback: LoadProgressCallback,
completeCallback: LoadCompleteCallback<T>,
);
public loadRes<T> (
url: string,
type: Constructor<T>,
progressCallback: LoadProgressCallback,
completeCallback: LoadCompleteCallback<T>,
);
public loadRes<T> (
url: string,
type: Constructor<T>,
completeCallback: LoadCompleteCallback<T>,
);
// @typescript
// loadRes(url: string, type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any) => void)|null): void
// loadRes(url: string, type: typeof cc.Asset, completeCallback: (error: Error, resource: any) => void): void
+6 -2
View File
@@ -1,5 +1,9 @@
type LoadSuccessParams<T> = Parameters<(error: null, asset: T) => void>;
type LoadSuccessParams<T> = Parameters<(error: null | undefined, asset: T) => void>;
type LoadErrorParams<T> = Parameters<(error?: Error) => void>;
type LoadErrorParams<T> = Parameters<(error: Error) => void>;
export type LoadCallbackParams<T> = LoadSuccessParams<T> | LoadErrorParams<T>;
export type LoadCompleteCallback<T> = (...args: LoadCallbackParams<T>) => void;
export type LoadProgressCallback = (completedCount: number, totalCount: number, item: any) => void;
+1 -1
View File
@@ -54,7 +54,7 @@ async function _doBundle (options: IBuildOptions) {
extensions: ['.js', '.ts'],
highlightCode: true,
ignore: [
'node_modules/**',
'node_modules/cannon/**',
],
plugins: [
['@babel/plugin-proposal-decorators', {