type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
ArrowFunction |
() => {
console.log(`[vite] server connection lost. polling for restart...`)
setInterval(() => {
fetch('/')
.then(() => {
location.reload()
})
.catch((e) => {
/* ignore */
})
}, 1000)
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
() => {
fetch('/')
.then(() => {
location.reload()
})
.catch((e) => {
/* ignore */
})
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
() => {
location.reload()
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
(e) => {
/* ignore */
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
() => {
try {
new CSSStyleSheet()
return true
} catch (e) {}
return false
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
(s: CSSStyleSheet) => s !== style | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
(dep) => modulesToUpdate.add(dep) | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
({ deps }) => {
return Array.isArray(deps)
? deps.some((dep) => modulesToUpdate.has(dep))
: modulesToUpdate.has(deps)
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
(dep) => modulesToUpdate.has(dep) | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
async (dep) => {
const disposer = disposeMap.get(dep)
if (disposer) await disposer(dataMap.get(dep))
try {
const newMod = await import(
dep + (dep.includes('?') ? '&' : '?') + `t=${timestamp}`
)
moduleMap.set(dep, newMod)
} catch (e) {
warnFailedFetch(e, dep)
}
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
() => {
for (const { deps, fn } of callbacks) {
if (Array.isArray(deps)) {
fn(deps.map((dep) => moduleMap.get(dep)))
} else {
fn(moduleMap.get(deps))
}
}
console.log(`[vite]: js module hot updated: `, id)
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
(dep) => moduleMap.get(dep) | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
(id: string) => {
if (!dataMap.has(id)) {
dataMap.set(id, {})
}
// when a file is hot updated, a new context is created
// clear its stale callbacks
const mod = hotModulesMap.get(id)
if (mod) {
mod.callbacks = []
}
const hot = {
get data() {
return dataMap.get(id)
},
accept(callback: HotCallback['fn'] = () => {}) {
hot.acceptDeps(id, callback)
},
acceptDeps(
deps: HotCallback['deps'],
callback: HotCallback['fn'] = () => {}
) {
const mod: HotModule = hotModulesMap.get(id) || {
id,
callbacks: []
}
mod.callbacks.push({
deps: deps as HotCallback['deps'],
fn: callback
})
hotModulesMap.set(id, mod)
},
dispose(cb: (data: any) => void) {
disposeMap.set(id, cb)
},
// noop, used for static analysis only
decline() {},
invalidate() {
location.reload()
},
// custom events
on(event: string, cb: () => void) {
const existing = customUpdateMap.get(event) || []
existing.push(cb)
customUpdateMap.set(event, existing)
}
}
return hot
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
(r) => {
const channel = new MessageChannel()
channel.port1.onmessage = (e) => {
if (e.data.busted) r()
}
sw.postMessage(
{
type: 'bust-cache',
path: `${location.protocol}//${location.host}${path}`
},
[channel.port2]
)
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ArrowFunction |
(e) => {
if (e.data.busted) r()
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
InterfaceDeclaration |
interface HotModule {
id: string
callbacks: HotCallback[]
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
InterfaceDeclaration |
interface HotCallback {
deps: string | string[]
fn: (modules: object | object[]) => void
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
MethodDeclaration |
accept(callback: HotCallback['fn'] = () => {}) {
hot.acceptDeps(id, callback)
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
MethodDeclaration |
acceptDeps(
deps: HotCallback['deps'],
callback: HotCallback['fn'] = () => {}
) {
const mod: HotModule = hotModulesMap.get(id) || {
id,
callbacks: []
}
mod.callbacks.push({
deps: deps as HotCallback['deps'],
fn: callback
})
hotModulesMap.set(id, mod)
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
MethodDeclaration |
dispose(cb: (data: any) => void) {
disposeMap.set(id, cb)
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
MethodDeclaration | // noop, used for static analysis only
decline() {} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
MethodDeclaration |
invalidate() {
location.reload()
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
MethodDeclaration | // custom events
on(event: string, cb: () => void) {
const existing = customUpdateMap.get(event) || []
existing.push(cb)
customUpdateMap.set(event, existing)
} | MarvinRudolph/vite | src/client/client.ts | TypeScript |
ClassDeclaration |
@Entity()
export class User{
@PrimaryGeneratedColumn()
id: number;
@Column({ length: 100 })
displayName: String;
@Column({ length: 100 })
email: String;
@Column({ length: 200 })
password: String;
@Column({ length: 500 })
image: String;
@Column()
isAdmin: Boolean;
} | ptissera/checkinall | server-nest-mysql/src/users/entities/user.entity.ts | TypeScript |
FunctionDeclaration |
export default function findRowKeys(rows: any[], rowKey: RowKeyType, expanded?: boolean): any[]; | koenw/fullstack-hello | frontend/node_modules/.pnpm/[email protected]_9bdd65c2b60ce8638444b80b396a481b/node_modules/rsuite-table/es/utils/findRowKeys.d.ts | TypeScript |
ArrowFunction |
() => {
let component: RecentFilesComponent;
let fixture: ComponentFixture<RecentFilesComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecentFilesComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(RecentFilesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
} | max-geller/Moodl.io | apps/support/src/app/client/components/widgets/recent-files/recent-files.component.spec.ts | TypeScript |
ArrowFunction |
() => {
TestBed.configureTestingModule({
declarations: [ RecentFilesComponent ]
})
.compileComponents();
} | max-geller/Moodl.io | apps/support/src/app/client/components/widgets/recent-files/recent-files.component.spec.ts | TypeScript |
ArrowFunction |
() => {
fixture = TestBed.createComponent(RecentFilesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
} | max-geller/Moodl.io | apps/support/src/app/client/components/widgets/recent-files/recent-files.component.spec.ts | TypeScript |
FunctionDeclaration |
export function helmReleaseReducer(state = defaultState, action) {
switch (action.type) {
case UPDATE_HELM_RELEASE:
return {
...state,
};
}
} | HCL-Cloud-Native-Labs/stratos | src/frontend/packages/kubernetes/src/kubernetes/workloads/store/workloads.reducers.ts | TypeScript |
FunctionDeclaration |
export function loadMoreResults(state: State): ThunkAction<Promise<void>, any, {}, Action> {
const { location, related_files, status } = state
if (status === Status.NoSearch || !location) {
console.error("unable to load more results: bad search state")
return () => Promise.resolve()
}
return async (dispatch): Promise<void> => {
return requestRelated(location, related_files.length, state.editor, dispatch)
}
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
FunctionDeclaration |
export function openFile(
state: State,
appPath: string,
filename: string,
line: number,
file_rank: number,
block_rank?: number,
): ThunkAction<Promise<void>, any, {}, Action> {
return (dispatch) => {
const request: OpenFileRequest = {
path: appPath,
filename: filename,
line,
block_rank,
file_rank,
}
return dispatch(POST({
url: "/clientapi/plugins/" + state.editor + "/open",
options: {
body: JSON.stringify(request),
},
})).then(({ success, error }: any) => {
if (!success && error) {
throw new Error(error)
}
})
}
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
FunctionDeclaration |
export function reloadSearch(state: State): ThunkAction<void, {}, {}, Action> {
const { location, status } = state
if (status === Status.NoSearch || !location) {
console.error("unable to reload search: bad search state")
return () => Promise.resolve()
}
return relatedCodeEvent({
editor: state.editor,
editor_install_path: state.editor_install_path,
location: state.location,
relative_filename: state.relative_filename,
filename: state.filename,
relative_path: state.relative_path,
project_tag: state.project_tag,
} as Push)
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
FunctionDeclaration |
function requestRelated(location: Location, offset: number, editor: string, dispatch: ThunkDispatch<any, {}, Action>): Promise<void> {
let request: FetchRequest = {
...LoadResultsParams,
location,
offset,
editor,
}
return dispatch(POST({
url: "/codenav/related",
options: {
body: JSON.stringify(request),
},
}))
.then(({ success, data, status, error }: any) => {
if (success) {
dispatch({
type: ActionType.LoadResults,
data: JSON.parse(data),
})
} else if (status === 405) {
dispatch({
type: ActionType.Stale,
})
} else {
dispatch({
type: ActionType.Error,
data: error,
})
}
})
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
FunctionDeclaration |
export function relatedCodeEvent(push: Push): ThunkAction<void, {}, {}, Action> {
return (dispatch) => {
// Push the loading state
dispatch({
type: ActionType.NewSearch,
data: push,
})
// Fetch initial results and update state
requestRelated(push.location, 0, push.editor, dispatch)
}
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
FunctionDeclaration |
export function reducer(state: State = defaultState, action: Action): any {
switch (action.type) {
case ActionType.Error:
console.error("related code error:", action.data)
return {
...state,
error: action.data,
status: Status.Error,
}
case ActionType.LoadResults:
return {
...state,
status: action.data.related_files.length < LoadResultsParams.num_files ? Status.NoMoreResults : Status.Loaded,
project_root: action.data.project_root,
related_files: state.related_files.concat(action.data.related_files),
}
case ActionType.NewSearch:
ipcRenderer.send('focus-window')
return {
...defaultState,
id: Date.now(),
status: Status.Loading,
editor: action.data.editor,
editor_install_path: action.data.editor_install_path,
location: action.data.location,
project_tag: action.data.project_tag,
filename: action.data.filename,
relative_path: action.data.relative_path,
}
case ActionType.Stale:
return {
...state,
status: Status.Stale,
}
default:
return state
}
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
ArrowFunction |
() => Promise.resolve() | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
ArrowFunction |
async (dispatch): Promise<void> => {
return requestRelated(location, related_files.length, state.editor, dispatch)
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
ArrowFunction |
(dispatch) => {
const request: OpenFileRequest = {
path: appPath,
filename: filename,
line,
block_rank,
file_rank,
}
return dispatch(POST({
url: "/clientapi/plugins/" + state.editor + "/open",
options: {
body: JSON.stringify(request),
},
})).then(({ success, error }: any) => {
if (!success && error) {
throw new Error(error)
}
})
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
ArrowFunction |
({ success, error }: any) => {
if (!success && error) {
throw new Error(error)
}
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
ArrowFunction |
({ success, data, status, error }: any) => {
if (success) {
dispatch({
type: ActionType.LoadResults,
data: JSON.parse(data),
})
} else if (status === 405) {
dispatch({
type: ActionType.Stale,
})
} else {
dispatch({
type: ActionType.Error,
data: error,
})
}
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
ArrowFunction |
(dispatch) => {
// Push the loading state
dispatch({
type: ActionType.NewSearch,
data: push,
})
// Fetch initial results and update state
requestRelated(push.location, 0, push.editor, dispatch)
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
InterfaceDeclaration |
interface ErrorAction extends BaseAction {
type: ActionType.Error
data: string
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
InterfaceDeclaration |
interface LoadResultsAction extends BaseAction {
type: ActionType.LoadResults
data: FetchResponse
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
InterfaceDeclaration |
interface NewSearchAction extends BaseAction {
type: ActionType.NewSearch
data: Push
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
InterfaceDeclaration |
interface StaleAction extends BaseAction {
type: ActionType.Stale
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
InterfaceDeclaration |
export interface State {
status: Status,
editor: string,
editor_install_path: string,
error: string,
project_tag: string,
project_root: string,
location?: Location,
relative_filename: string,
relative_path: string,
filename: string,
related_files: RelatedFile[],
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
EnumDeclaration |
enum ActionType {
Error = "relatedcode.error",
LoadResults = "relatedcode.loadresults",
NewSearch = "relatedcode.newsearch",
Stale = "relatedcode.stale",
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
EnumDeclaration |
export enum Status {
NoSearch = "NoSearch",
Loading = "Loading",
Loaded = "Loaded",
NoMoreResults = "NoMoreResults",
Stale = "Stale",
Error = "Error"
} | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
TypeAliasDeclaration |
type Action = ErrorAction | LoadResultsAction | NewSearchAction | StaleAction | kiteco/kiteco-public | sidebar/src/store/related-code/related-code.tsx | TypeScript |
ArrowFunction |
() => {
let component: HardwareItemComponent;
let fixture: ComponentFixture<HardwareItemComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HardwareItemComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HardwareItemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
} | ManishLade/cableapp | src/app/layout/manage-item/item-opening/item-opening.component.spec.ts | TypeScript |
ArrowFunction |
() => {
TestBed.configureTestingModule({
declarations: [ HardwareItemComponent ]
})
.compileComponents();
} | ManishLade/cableapp | src/app/layout/manage-item/item-opening/item-opening.component.spec.ts | TypeScript |
ArrowFunction |
() => {
fixture = TestBed.createComponent(HardwareItemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
} | ManishLade/cableapp | src/app/layout/manage-item/item-opening/item-opening.component.spec.ts | TypeScript |
ArrowFunction |
props => {
return (
<Select<SelectOption>
value={helpers.stringToSelectOpt(props.value)}
options={[
{ label: NodeLifecycle.SPOT, value: NodeLifecycle.SPOT },
{ label: NodeLifecycle.ON_DEMAND, value: NodeLifecycle.ON_DEMAND },
]}
isClearable
onChange={option | alienrobotwizard/flotilla-os | ui/src/components/NodeLifecycleSelect.tsx | TypeScript |
FunctionDeclaration | // ===
async function test(enable: boolean, name: string, fun: () => void, duration = 1000) {
if (!enable) return
console.group(name)
fun()
await new Promise((resolve, reject) => {
setTimeout(() => resolve(true), duration)
})
console.log(`test end (${name})`)
console.groupEnd()
return
} | alibaba/spatial-data-vis-framework | packages/polaris/polaris-three/examples/index.ts | TypeScript |
ArrowFunction |
() => {
const p = new PolarisThree({
container: document.querySelector('#container') as HTMLDivElement,
background: 'transparent',
// autoplay: false,
})
p.setStatesCode('1|0.000000|0.000000|0.000000|0.74540|0.84000|17.77600')
// p.addEventListener('viewChange', (e) => {
// console.log(e)
// })
globalThis.p = p
console.log(p)
const scene = generateScene({
// scale: 1000,
count: 10,
depth: 10,
useAnimation: true,
useSprite: true,
usePoint: false,
resolution: [500, 500],
})
console.log(scene)
const indicator = new IndicatorProcessor({
// hideOriginal: true,
useBBox: true,
useBSphere: true,
// useWireframe: true,
})
// indicator.traverse(scene)
const l = new StandardLayer({})
l.view.gsi.group.add(scene)
p.add(l)
const r = new Reflector({ clipBias: 0.01, debug: true, debugBlur: true })
// r.position.z = 10
// r.position.x = -100
r.updateMatrixWorld()
p.renderer['scene'].add(r)
} | alibaba/spatial-data-vis-framework | packages/polaris/polaris-three/examples/index.ts | TypeScript |
ArrowFunction |
(resolve, reject) => {
setTimeout(() => resolve(true), duration)
} | alibaba/spatial-data-vis-framework | packages/polaris/polaris-three/examples/index.ts | TypeScript |
ArrowFunction |
() => resolve(true) | alibaba/spatial-data-vis-framework | packages/polaris/polaris-three/examples/index.ts | TypeScript |
ArrowFunction |
(binop: ad.Binary["binop"]) => (
v: VarAD,
w: VarAD
): ad.Binary => ({ tag: "Binary", binop, i: count++, left: v, right: w }) | cmumatt/penrose | packages/core/src/engine/AutodiffFunctions.ts | TypeScript |
ArrowFunction |
(
v: VarAD,
w: VarAD
): ad.Binary => ({ tag: "Binary", binop, i: count++, left: v, right: w }) | cmumatt/penrose | packages/core/src/engine/AutodiffFunctions.ts | TypeScript |
ArrowFunction |
(op: ad.Nary["op"], bin: (v: VarAD, w: VarAD) => ad.Binary) => (
xs: VarAD[]
): VarAD => {
// interestingly, special-casing 1 and 2 args like this actually affects the
// gradient by a nontrivial amount in some cases
switch (xs.length) {
case 1: {
return xs[0];
}
case 2: {
return bin(xs[0], xs[1]);
}
default: {
return { tag: "Nary", i: count++, op, params: xs };
}
}
} | cmumatt/penrose | packages/core/src/engine/AutodiffFunctions.ts | TypeScript |
ArrowFunction |
(
xs: VarAD[]
): VarAD => {
// interestingly, special-casing 1 and 2 args like this actually affects the
// gradient by a nontrivial amount in some cases
switch (xs.length) {
case 1: {
return xs[0];
}
case 2: {
return bin(xs[0], xs[1]);
}
default: {
return { tag: "Nary", i: count++, op, params: xs };
}
}
} | cmumatt/penrose | packages/core/src/engine/AutodiffFunctions.ts | TypeScript |
ArrowFunction |
(y: VarAD, x: VarAD): ad.Binary => ({
tag: "Binary",
i: count++,
binop: "atan2",
left: y,
right: x,
}) | cmumatt/penrose | packages/core/src/engine/AutodiffFunctions.ts | TypeScript |
ArrowFunction |
(unop: ad.Unary["unop"]) => (v: VarAD): ad.Unary => ({
tag: "Unary",
i: count++,
unop,
param: v,
}) | cmumatt/penrose | packages/core/src/engine/AutodiffFunctions.ts | TypeScript |
ArrowFunction |
(v: VarAD): ad.Unary => ({
tag: "Unary",
i: count++,
unop,
param: v,
}) | cmumatt/penrose | packages/core/src/engine/AutodiffFunctions.ts | TypeScript |
ArrowFunction |
(cond: VarAD, v: VarAD, w: VarAD): ad.Ternary => ({
tag: "Ternary",
i: count++,
cond,
then: v,
els: w,
}) | cmumatt/penrose | packages/core/src/engine/AutodiffFunctions.ts | TypeScript |
ArrowFunction |
() => server.listen({ onUnhandledRequest: "error" }) | AriFreyr/prismic-client | test/client-getAllByIDs.test.ts | TypeScript |
ArrowFunction |
() => server.close() | AriFreyr/prismic-client | test/client-getAllByIDs.test.ts | TypeScript |
ArrowFunction |
async (t) => {
const repositoryResponse = createRepositoryResponse();
const pagedResponses = createQueryResponsePages({
numPages: 2,
numDocsPerPage: 2,
});
const allDocs = pagedResponses.flatMap((page) => page.results);
const allDocumentIds = allDocs.map((doc) => doc.id);
server.use(
createMockRepositoryHandler(t, repositoryResponse),
createMockQueryHandler(t, pagedResponses, undefined, {
ref: getMasterRef(repositoryResponse),
q: `[[in(document.id, [${allDocumentIds
.map((id) => `"${id}"`)
.join(", ")}])]]`,
pageSize: 100,
}),
);
const client = createTestClient(t);
const res = await client.getAllByIDs(allDocumentIds.filter(Boolean));
t.deepEqual(res, allDocs);
t.is(res.length, 2 * 2);
} | AriFreyr/prismic-client | test/client-getAllByIDs.test.ts | TypeScript |
ArrowFunction |
(page) => page.results | AriFreyr/prismic-client | test/client-getAllByIDs.test.ts | TypeScript |
ArrowFunction |
(doc) => doc.id | AriFreyr/prismic-client | test/client-getAllByIDs.test.ts | TypeScript |
ArrowFunction |
(id) => `"${id}"` | AriFreyr/prismic-client | test/client-getAllByIDs.test.ts | TypeScript |
ArrowFunction |
async (t) => {
const params: prismic.BuildQueryURLArgs = {
accessToken: "custom-accessToken",
ref: "custom-ref",
lang: "*",
};
const pagedResponses = createQueryResponsePages({
numPages: 3,
numDocsPerPage: 3,
});
const allDocs = pagedResponses.flatMap((page) => page.results);
const allDocumentIds = allDocs.map((doc) => doc.id);
server.use(
createMockRepositoryHandler(t),
createMockQueryHandler(t, pagedResponses, params.accessToken, {
ref: params.ref as string,
q: `[[in(document.id, [${allDocumentIds
.map((id) => `"${id}"`)
.join(", ")}])]]`,
lang: params.lang,
pageSize: 100,
}),
);
const client = createTestClient(t);
const res = await client.getAllByIDs(allDocumentIds, params);
t.deepEqual(res, allDocs);
t.is(res.length, 3 * 3);
} | AriFreyr/prismic-client | test/client-getAllByIDs.test.ts | TypeScript |
InterfaceDeclaration |
export interface RevisionContract {
apiId: string;
/**
* Example: "1"
*/
apiRevision: string;
/**
* Example: "2016-12-01T19:30:35.763"
*/
createdDateTime: string;
/**
* Example: "2016-12-01T19:30:35.763"
*/
updatedDateTime: string;
description: string;
/**
* Example: "/amazons3;rev=0"
*/
privateUrl: string;
isOnline: boolean;
isCurrent: boolean;
} | 191540/api-management-developer-portal | src/contracts/revision.ts | TypeScript |
FunctionDeclaration |
function getResourceInfo(path: string): File | null; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration |
function setConfigURL(url: string, root: string): void; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration |
function profile(): void; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration |
function setUpgradeGuideLevel(level: "warning" | "silent"): void; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration |
function isSupport(resource: ResourceInfo): Processor; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration |
function map(type: string, processor: Processor): void; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration |
function getRelativePath(url: string, file: string): string; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration |
function convertToResItem(r: ResourceInfo): ResourceItem; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Conduct mapping injection with class definition as the value.
* @param type Injection type.
* @param analyzerClass Injection type classes need to be resolved.
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/resource/Resource.ts
* @language en_US
*/
/**
* 以类定义为值进行映射注入。
* @param type 注入的类型。
* @param analyzerClass 注入类型需要解析的类。
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/resource/Resource.ts
* @language zh_CN
*/
function registerAnalyzer(type: string, analyzerClass: any): void; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Load configuration file and parse.
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 加载配置文件并解析。
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function loadConfig(url: string, resourceRoot: string): Promise<void>; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Load a set of resources according to the group name.
* @param name Group name to load the resource group.
* @param priority Load priority can be negative, the default value is 0.
* <br>A low priority group must wait for the high priority group to complete the end of the load to start, and the same priority group will be loaded at the same time.
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 根据组名加载一组资源。
* @param name 要加载资源组的组名。
* @param priority 加载优先级,可以为负数,默认值为 0。
* <br>低优先级的组必须等待高优先级组完全加载结束才能开始,同一优先级的组会同时加载。
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function loadGroup(name: string, priority?: number, reporter?: PromiseTaskReporter): Promise<void>; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Check whether a resource group has been loaded.
* @param name Group name。
* @returns Is loading or not.
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 检查某个资源组是否已经加载完成。
* @param name 组名。
* @returns 是否正在加载。
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function isGroupLoaded(name: string): boolean; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* A list of groups of loading is obtained according to the group name.
* @param name Group name.
* @returns The resource item array of group.
* @see RES.ResourceItem
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 根据组名获取组加载项列表。
* @param name 组名。
* @returns 加载项列表。
* @see RES.ResourceItem
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function getGroupByName(name: string): Array<ResourceItem>; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Create a custom load resource group, note that this method is valid only after the resource configuration file is loaded.
* <br>You can monitor the ResourceEvent.CONFIG_COMPLETE event to verify that the configuration is complete.
* @param name Group name to create the load resource group.
* @param keys To be included in the list of key keys, the corresponding configuration file in the name or sbuKeys property one or a resource group name.
* @param override Is the default false for the same name resource group already exists.
* @returns Create success or fail.
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。
* <br>可以监听 ResourceEvent.CONFIG_COMPLETE 事件来确认配置加载完成。
* @param name 要创建的加载资源组的组名。
* @param keys 要包含的键名列表,key 对应配置文件里的 name 属性或 sbuKeys 属性的一项或一个资源组名。
* @param override 是否覆盖已经存在的同名资源组,默认 false。
* @returns 是否创建成功。
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function createGroup(name: string, keys: Array<string>, override?: boolean): boolean; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Check whether the configuration file contains the specified resources.
* @param key A sbuKeys attribute or name property in a configuration file.
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 检查配置文件里是否含有指定的资源。
* @param key 对应配置文件里的 name 属性或 sbuKeys 属性的一项。
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function hasRes(key: string): boolean; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* The synchronization method for obtaining the cache has been loaded with the success of the resource.
* <br>The type of resource and the corresponding return value types are as follows:
* <br>RES.ResourceItem.TYPE_BIN : ArrayBuffer JavaScript primary object
* <br>RES.ResourceItem.TYPE_IMAGE : img Html Object,or egret.BitmapData interface。
* <br>RES.ResourceItem.TYPE_JSON : Object
* <br>RES.ResourceItem.TYPE_SHEET : Object
* <br> 1. If the incoming parameter is the name of the entire SpriteSheet is returned is {image1: Texture, "image2": Texture}.
* <br> 2. If the incoming is "sheet.image1", the return is a single resource.
* <br> 3. If the incoming is the name of the "image1" single resource, the return is a single resource.
* But if there are two SpriteSheet in a single picture of the same name, the return of the image after the load.
* <br>RES.ResourceItem.TYPE_SOUND : HtmlSound Html Object
* <br>RES.ResourceItem.TYPE_TEXT : string
* @param key A subKeys attribute or name property in a configuration file.
* @see RES.ResourceItem
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 同步方式获取缓存的已经加载成功的资源。
* <br>资源类型和对应的返回值类型关系如下:
* <br>RES.ResourceItem.TYPE_BIN : ArrayBuffer JavaScript 原生对象
* <br>RES.ResourceItem.TYPE_IMAGE : img Html 对象,或者 egret.BitmapData 接口。
* <br>RES.ResourceItem.TYPE_JSON : Object
* <br>RES.ResourceItem.TYPE_SHEET : Object
* <br> 1. 如果传入的参数是整个 SpriteSheet 的名称返回的是 {"image1":Texture,"image2":Texture} 这样的格式。
* <br> 2. 如果传入的是 "sheet.image1",返回的是单个资源。
* <br> 3. 如果传入的是 "image1" 单个资源的名称,返回的是单个资源。但是如果有两张 SpriteSheet 中有单个图片资源名称相同,返回的是后加载的那个图片资源。
* <br>RES.ResourceItem.TYPE_SOUND : HtmlSound Html 对象
* <br>RES.ResourceItem.TYPE_TEXT : string
* @param key 对应配置文件里的 name 属性或 subKeys 属性的一项。
* @see RES.ResourceItem
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function getRes(key: string): any; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Asynchronous mode to get the resources in the configuration. As long as the resources exist in the configuration file, you can get it in an asynchronous way.
* @param key A sbuKeys attribute or name property in a configuration file.
* @param compFunc Call back function. Example:compFunc(data,key):void.
* @param thisObject This pointer of call back function.
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 异步方式获取配置里的资源。只要是配置文件里存在的资源,都可以通过异步方式获取。
* @param key 对应配置文件里的 name 属性或 sbuKeys 属性的一项。
* @param compFunc 回调函数。示例:compFunc(data,key):void。
* @param thisObject 回调函数的 this 引用。
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function getResAsync(key: string): Promise<any>; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration |
function getResAsync(key: string, compFunc: GetResAsyncCallback, thisObject: any): void; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Access to external resources through the full URL.
* @param url The external path to load the file.
* @param compFunc Call back function. Example:compFunc(data,url):void。
* @param thisObject This pointer of call back function.
* @param type File type (optional). Use the static constants defined in the ResourceItem class. If you do not set the file name extension.
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/resource/GetResByUrl.ts
* @language en_US
*/
/**
* 通过完整URL方式获取外部资源。
* @param url 要加载文件的外部路径。
* @param compFunc 回调函数。示例:compFunc(data,url):void。
* @param thisObject 回调函数的 this 引用。
* @param type 文件类型(可选)。请使用 ResourceItem 类中定义的静态常量。若不设置将根据文件扩展名生成。
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/resource/GetResByUrl.ts
* @language zh_CN
*/
function getResByUrl(url: string, compFunc: Function, thisObject: any, type?: string): void; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Destroy a single resource file or a set of resources to the cache data, to return whether to delete success.
* @param name Name attribute or resource group name of the load item in the configuration file.
* @param force Destruction of a resource group when the other resources groups have the same resource situation whether the resources will be deleted, the default value true.
* @returns Are successful destruction.
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 销毁单个资源文件或一组资源的缓存数据,返回是否删除成功。
* @param name 配置文件中加载项的name属性或资源组名。
* @param force 销毁一个资源组时其他资源组有同样资源情况资源是否会被删除,默认值 true。
* @see #setMaxRetryTimes
* @returns 是否销毁成功。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function destroyRes(name: string, force?: boolean): Promise<boolean>; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Sets the maximum number of concurrent load threads, the default value is 2.
* @param thread The number of concurrent loads to be set.
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 设置最大并发加载线程数量,默认值是 2。
* @param thread 要设置的并发加载数。
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function setMaxLoadingThread(thread: number): void; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Sets the number of retry times when the resource failed to load, and the default value is 3.
* @param retry To set the retry count.
* @includeExample extension/resource/Resource.ts
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 设置资源加载失败时的重试次数,默认值是 3。
* @param retry 要设置的重试次数。
* @includeExample extension/resource/Resource.ts
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function setMaxRetryTimes(retry: number): void; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Add event listeners, reference ResourceEvent defined constants.
* @param type Event name。
* @param listener Listener functions for handling events. This function must accept the Event object as its only parameter, and can't return any results,
* As shown in the following example: function (evt:Event):void can have any name.
* @param thisObject The this object that is bound to a function.
* @param useCapture Determine the listener is running on the capture or running on the target and the bubbling phase. Set useCapture to true,
* then the listener in the capture phase processing events, but not in the target or the bubbling phase processing events.
* If useCapture is false, then the listener only in the target or the bubbling phase processing events.
* To listen for events in all three stages, please call addEventListener two times: once the useCapture is set to true, once the useCapture is set to false.
* @param priority Event listener priority. Priority is specified by a 32 - bit integer with a symbol. The higher the number, the higher the priority.
* All listeners with a priority for n will be processed before the -1 n listener.
* If two or more listeners share the same priority, they are processed in accordance with the order of their added. The default priority is 0.
* @see RES.ResourceEvent
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 添加事件侦听器,参考 ResourceEvent 定义的常量。
* @param type 事件的类型。
* @param listener 处理事件的侦听器函数。此函数必须接受 Event 对象作为其唯一的参数,并且不能返回任何结果,
* 如下面的示例所示: function(evt:Event):void 函数可以有任何名称。
* @param thisObject 侦听函数绑定的 this 对象。
* @param useCapture 确定侦听器是运行于捕获阶段还是运行于目标和冒泡阶段。如果将 useCapture 设置为 true,
* 则侦听器只在捕获阶段处理事件,而不在目标或冒泡阶段处理事件。如果 useCapture 为 false,则侦听器只在目标或冒泡阶段处理事件。
* 要在所有三个阶段都侦听事件,请调用 addEventListener 两次:一次将 useCapture 设置为 true,一次将 useCapture 设置为 false。
* @param priority 事件侦听器的优先级。优先级由一个带符号的 32 位整数指定。数字越大,优先级越高。优先级为 n 的所有侦听器会在
* 优先级为 n -1 的侦听器之前得到处理。如果两个或更多个侦听器共享相同的优先级,则按照它们的添加顺序进行处理。默认优先级为 0。
* @see RES.ResourceEvent
* @see #setMaxRetryTimes
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function addEventListener(type: string, listener: (event: egret.Event) => void, thisObject: any, useCapture?: boolean, priority?: number): void; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Remove event listeners, reference ResourceEvent defined constants.
* @param type Event name。
* @param listener Listening function。
* @param thisObject The this object that is bound to a function.
* @param useCapture Is used to capture, and this property is only valid in the display list.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 移除事件侦听器,参考ResourceEvent定义的常量。
* @param type 事件名。
* @param listener 侦听函数。
* @param thisObject 侦听函数绑定的this对象。
* @param useCapture 是否使用捕获,这个属性只在显示列表中生效。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function removeEventListener(type: string, listener: (event: egret.Event) => void, thisObject: any, useCapture?: boolean): void; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
FunctionDeclaration | /**
* Adding a custom resource configuration.
* @param data To add configuration.
* @version Egret 3.1.6
* @platform Web,Native
* @language en_US
*/
/**
* 自定义添加一项资源配置。
* @param data 要添加的配置。
* @version Egret 3.1.6
* @platform Web,Native
* @language zh_CN
*/
function $addResourceData(data: {
name: string;
type: string;
url: string;
}): void; | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
ClassDeclaration | /**
* @class RES.ResourceConfig
* @classdesc
* @private
*/
class ResourceConfig {
config: Data;
constructor();
init(): Promise<void>;
__temp__get__type__via__url(url_or_alias: string): string;
getKeyByAlias(aliasName: string): string;
/**
* 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。
* 可以监听ResourceEvent.CONFIG_COMPLETE事件来确认配置加载完成。
* @method RES.ResourceConfig#createGroup
* @param name {string} 要创建的加载资源组的组名
* @param keys {egret.Array<string>} 要包含的键名列表,key对应配置文件里的name属性或sbuKeys属性的一项或一个资源组名。
* @param override {boolean} 是否覆盖已经存在的同名资源组,默认false。
* @returns {boolean}
*/
createGroup(name: string, keys: Array<string>, override?: boolean): boolean;
/**
* 添加一个二级键名到配置列表。
* @method RES.ResourceConfig#addSubkey
* @param subkey {string} 要添加的二级键名
* @param name {string} 二级键名所属的资源name属性
*/
addSubkey(subkey: string, name: string): void;
addAlias(alias: any, key: any): void;
/**
* 获取加载项类型。
* @method RES.ResourceConfig#getType
* @param key {string} 对应配置文件里的name属性或sbuKeys属性的一项。
* @returns {string}
*/
getType(key: string): string;
addResourceData(data: {
name: string;
type?: string;
url: string;
root?: string;
}): void;
destory(): void;
} | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
ClassDeclaration | /**
* @class RES.ResourceLoader
* @classdesc
* @private
*/
class ResourceLoader {
/**
* 当前组加载的项总个数,key为groupName
*/
private groupTotalDic;
/**
* 已经加载的项个数,key为groupName
*/
private numLoadedDic;
/**
* 正在加载的组列表,key为groupName
*/
private itemListDic;
/**
* 加载失败的组,key为groupName
*/
private groupErrorDic;
private retryTimesDic;
maxRetryTimes: number;
/**
* 优先级队列,key为priority,value为groupName列表
*/
private priorityQueue;
private reporterDic;
private dispatcherDic;
private failedList;
private loadItemErrorDic;
private errorDic;
load(list: ResourceInfo[], groupName: string, priority: number, reporter?: PromiseTaskReporter): Promise<any>;
private loadingCount;
thread: number;
private next();
/**
* 从优先级队列中移除指定的组名
*/
private removeGroupName(groupName);
private queueIndex;
/**
* 获取下一个待加载项
*/
private getOneResourceInfo();
loadResource(r: ResourceInfo, p?: RES.processor.Processor): Promise<any>;
unloadResource(r: ResourceInfo): Promise<any>;
} | SixiMeatballs/EgretGame | Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.