type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction
|
() => {
let simpleForm: EditContentForm;
beforeEach(() => {
simpleForm = createForm([
createField({ id: 1, properties: createProperties('String'), partitioning: 'invariant' }),
]);
});
it('should not be an unsaved change if nothing has changed', () => {
expect(simpleForm.hasChanged()).toBeFalsy();
});
it('should be an unsaved change if value has changed but not saved', () => {
simpleForm.form.setValue({ field1: { iv: 'Change' } });
expect(simpleForm.hasChanged()).toBeTruthy();
});
it('should not be an unsaved change if value has changed and saved', () => {
simpleForm.form.setValue({ field1: { iv: 'Change' } });
simpleForm.submit();
simpleForm.submitCompleted();
expect(simpleForm.hasChanged()).toBeFalsy();
});
it('should subscribe to values', () => {
simpleForm.form.setValue({ field1: { iv: 'Change' } });
let value: any;
simpleForm.valueChanges.subscribe(result => {
value = result;
});
expect(value).toEqual({ field1: { iv: 'Change' } });
});
}
|
MartijnDijkgraaf/squidex
|
frontend/src/app/shared/state/contents.forms.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
simpleForm = createForm([
createField({ id: 1, properties: createProperties('String'), partitioning: 'invariant' }),
]);
}
|
MartijnDijkgraaf/squidex
|
frontend/src/app/shared/state/contents.forms.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
expect(simpleForm.hasChanged()).toBeFalsy();
}
|
MartijnDijkgraaf/squidex
|
frontend/src/app/shared/state/contents.forms.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
simpleForm.form.setValue({ field1: { iv: 'Change' } });
expect(simpleForm.hasChanged()).toBeTruthy();
}
|
MartijnDijkgraaf/squidex
|
frontend/src/app/shared/state/contents.forms.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
simpleForm.form.setValue({ field1: { iv: 'Change' } });
simpleForm.submit();
simpleForm.submitCompleted();
expect(simpleForm.hasChanged()).toBeFalsy();
}
|
MartijnDijkgraaf/squidex
|
frontend/src/app/shared/state/contents.forms.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
simpleForm.form.setValue({ field1: { iv: 'Change' } });
let value: any;
simpleForm.valueChanges.subscribe(result => {
value = result;
});
expect(value).toEqual({ field1: { iv: 'Change' } });
}
|
MartijnDijkgraaf/squidex
|
frontend/src/app/shared/state/contents.forms.spec.ts
|
TypeScript
|
ArrowFunction
|
result => {
value = result;
}
|
MartijnDijkgraaf/squidex
|
frontend/src/app/shared/state/contents.forms.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
let simpleForm: EditContentForm;
beforeEach(() => {
simpleForm = createForm([
createField({ id: 1, properties: createProperties('String'), partitioning: 'invariant' }),
]);
simpleForm.load({ field1: { iv: 'Initial' } }, true);
});
it('should not be an unsaved change if nothing has changed', () => {
simpleForm.load({ field1: { iv: 'Initial' } }, true);
expect(simpleForm.hasChanged()).toBeFalsy();
});
it('should be an unsaved change if value has changed but not saved', () => {
simpleForm.form.setValue({ field1: { iv: 'Change' } });
expect(simpleForm.hasChanged()).toBeTruthy();
});
it('should be an unsaved change if value has been loaded but not saved', () => {
simpleForm.load({ field1: { iv: 'Prev' } });
expect(simpleForm.hasChanged()).toBeTruthy();
});
it('should not be an unsaved change if value has changed and saved', () => {
simpleForm.form.setValue({ field1: { iv: 'Change' } });
simpleForm.submit();
simpleForm.submitCompleted();
expect(simpleForm.hasChanged()).toBeFalsy();
});
it('should not be an unsaved change if value has been loaded but not saved', () => {
simpleForm.load({ field1: { iv: 'Prev' } });
simpleForm.submit();
simpleForm.submitCompleted();
expect(simpleForm.hasChanged()).toBeFalsy();
});
}
|
MartijnDijkgraaf/squidex
|
frontend/src/app/shared/state/contents.forms.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
simpleForm = createForm([
createField({ id: 1, properties: createProperties('String'), partitioning: 'invariant' }),
]);
simpleForm.load({ field1: { iv: 'Initial' } }, true);
}
|
MartijnDijkgraaf/squidex
|
frontend/src/app/shared/state/contents.forms.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
simpleForm.load({ field1: { iv: 'Initial' } }, true);
expect(simpleForm.hasChanged()).toBeFalsy();
}
|
MartijnDijkgraaf/squidex
|
frontend/src/app/shared/state/contents.forms.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
simpleForm.load({ field1: { iv: 'Prev' } });
expect(simpleForm.hasChanged()).toBeTruthy();
}
|
MartijnDijkgraaf/squidex
|
frontend/src/app/shared/state/contents.forms.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
simpleForm.load({ field1: { iv: 'Prev' } });
simpleForm.submit();
simpleForm.submitCompleted();
expect(simpleForm.hasChanged()).toBeFalsy();
}
|
MartijnDijkgraaf/squidex
|
frontend/src/app/shared/state/contents.forms.spec.ts
|
TypeScript
|
FunctionDeclaration
|
/* eslint-disable sort-keys */
// The available endpoints that will show in the dropdown. For the most part (with the exception of
// Polkadot) we try to keep this to live chains only, with RPCs hosted by the community/chain vendor
// info: The chain logo name as defined in ../ui/logos/index.ts in namedLogos (this also needs to align with @polkadot/networks)
// text: The text to display on the dropdown
// value: The actual hosted secure websocket endpoint
export function createKusama (t: TFunction): EndpointOption {
return {
dnslink: 'kusama',
genesisHash: KUSAMA_GENESIS,
info: 'kusama',
text: t('rpc.kusama.parity', 'Kusama', { ns: 'apps-config' }),
providers: {
Parity: 'wss://kusama-rpc.polkadot.io',
OnFinality: 'wss://kusama.api.onfinality.io/public-ws',
'Patract Elara': 'wss://kusama.elara.patract.io',
'light client': 'light://substrate-connect/kusama'
// Pinknode: 'wss://rpc.pinknode.io/kusama/explorer' // https://github.com/polkadot-js/apps/issues/5721
},
teleport: [1000],
linked: [
// (1) all system parachains (none available yet)
// ...
// (2) all common good parachains
/* {
info: 'statemine',
paraId: 1000,
text: t('rpc.kusama.statemine', 'Statemine', { ns: 'apps-config' }),
providers: {
Parity: 'wss://kusama-statemine-rpc.paritytech.net',
OnFinality: 'wss://statemine.api.onfinality.io/public-ws',
'Patract Elara': 'wss://statemine.kusama.elara.patract.io'
},
teleport: [-1]
}, */
/// (3) parachains with id, see Rococo (info here maps to the actual "named icon")
//
// NOTE: Added alphabetical based on chain name
{
info: 'robonomics',
homepage: 'http://robonomics.network/',
paraId: 2077,
text: t('rpc.kusama.robonomics', 'Robonomics', { ns: 'apps-config' }),
providers: {
Airalab: 'wss://kusama.rpc.robonomics.network/'
}
}
]
};
}
|
airalab/polkadot-apps
|
packages/apps-config/src/endpoints/productionRelayKusama.ts
|
TypeScript
|
FunctionDeclaration
|
export function spawn(
initFunc: (actor: any, ...args: any[]) => void,
...args: any[]
) {
const actor = new actorClass();
actor.init(initFunc, ...args);
return actor;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
FunctionDeclaration
|
export function addUpdater(
updateFunc: (updater: Updater, actor?: Actor) => void,
interval = 1
) {
const updater = new Updater(updateFunc, interval);
updaterPool.add(updater);
return updater;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
FunctionDeclaration
|
export function update() {
pool.update();
updaterPool.update();
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
FunctionDeclaration
|
export function reset() {
pool.removeAll();
updaterPool.removeAll();
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
FunctionDeclaration
|
export function setActorClass(_actorClass: any) {
actorClass = _actorClass;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
FunctionDeclaration
|
function stableSort(values: any[], compareFunc: Function) {
const indexedValues = values.map((v, i) => [v, i]);
indexedValues.sort((a, b) => {
const cmp = compareFunc(a[0], b[0]);
return cmp !== 0 ? cmp : a[1] - b[1];
});
return indexedValues.map(v => v[0]);
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
ArrowFunction
|
(a: any, b: any) => b.priority - a.priority
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
ArrowFunction
|
a => a.isAlive
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
ArrowFunction
|
a => a.func === func && a.isAlive
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
ArrowFunction
|
a => {
a.remove();
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
ArrowFunction
|
(v, i) => [v, i]
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
ArrowFunction
|
(a, b) => {
const cmp = compareFunc(a[0], b[0]);
return cmp !== 0 ? cmp : a[1] - b[1];
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
ArrowFunction
|
v => v[0]
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
ClassDeclaration
|
export class Actor {
pool = pool;
func!: Function;
isAlive = true;
ticks = 0;
updaterPool = new Pool();
onRemove: Function | undefined;
priority = 1;
remove() {
if (!this.isAlive) {
return;
}
if (this.onRemove != null) {
this.onRemove();
}
this.isAlive = false;
}
addUpdater(
updateFunc: (updater: Updater, actor?: Actor) => void,
interval = 1
) {
const updater: Updater = new Updater(updateFunc, interval, this);
this.updaterPool.add(updater);
return updater;
}
setPool(pool: Pool) {
this.pool = pool;
}
setPriority(priority: number) {
this.priority = priority;
this.pool.enablePriority();
}
init(initFunc: (actor: any, ...args: any[]) => void, ...args: any[]) {
this.func = initFunc;
initFunc(this, ...args);
this.pool.add(this);
}
update() {
this.updaterPool.update();
this.ticks++;
}
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
ClassDeclaration
|
export class Updater {
func: Function;
isAlive = true;
ticks = 0;
intervalTicks = 0;
remove() {
this.isAlive = false;
}
setInterval(interval: number) {
this.interval = interval;
}
constructor(
public updateFunc: (updater: Updater, actor?: Actor) => void,
public interval: number,
public actor?: Actor
) {
this.func = updateFunc;
}
update() {
this.intervalTicks--;
if (this.intervalTicks <= 0) {
this.updateFunc(this, this.actor);
this.intervalTicks = this.interval;
}
this.ticks++;
}
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
ClassDeclaration
|
export class Pool {
instances: UpdatedInstance[] = [];
isRemovingAllInstances = false;
isPriorityEnabled = false;
add(instance: UpdatedInstance) {
this.instances.push(instance);
}
update() {
if (this.isPriorityEnabled) {
this.instances = stableSort(
this.instances,
(a: any, b: any) => b.priority - a.priority
);
}
for (let i = 0; i < this.instances.length; ) {
if (this.isRemovingAllInstances) {
this.isRemovingAllInstances = false;
break;
}
const instance = this.instances[i];
if (instance.isAlive) {
instance.update();
}
if (instance.isAlive) {
i++;
} else {
this.instances.splice(i, 1);
}
}
}
get(func?: Function) {
return func == null
? this.instances.filter(a => a.isAlive)
: this.instances.filter(a => a.func === func && a.isAlive);
}
removeAll() {
this.instances.forEach(a => {
a.remove();
});
this.instances = [];
this.isRemovingAllInstances = true;
}
enablePriority() {
this.isPriorityEnabled = true;
}
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface AnyActor extends Actor {
[key: string]: any;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface UpdatedInstance {
func: Function;
isAlive: boolean;
update: Function;
remove: Function;
priority?: number;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
remove() {
if (!this.isAlive) {
return;
}
if (this.onRemove != null) {
this.onRemove();
}
this.isAlive = false;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
addUpdater(
updateFunc: (updater: Updater, actor?: Actor) => void,
interval = 1
) {
const updater: Updater = new Updater(updateFunc, interval, this);
this.updaterPool.add(updater);
return updater;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
setPool(pool: Pool) {
this.pool = pool;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
setPriority(priority: number) {
this.priority = priority;
this.pool.enablePriority();
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
init(initFunc: (actor: any, ...args: any[]) => void, ...args: any[]) {
this.func = initFunc;
initFunc(this, ...args);
this.pool.add(this);
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
update() {
this.updaterPool.update();
this.ticks++;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
remove() {
this.isAlive = false;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
setInterval(interval: number) {
this.interval = interval;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
update() {
this.intervalTicks--;
if (this.intervalTicks <= 0) {
this.updateFunc(this, this.actor);
this.intervalTicks = this.interval;
}
this.ticks++;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
add(instance: UpdatedInstance) {
this.instances.push(instance);
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
update() {
if (this.isPriorityEnabled) {
this.instances = stableSort(
this.instances,
(a: any, b: any) => b.priority - a.priority
);
}
for (let i = 0; i < this.instances.length; ) {
if (this.isRemovingAllInstances) {
this.isRemovingAllInstances = false;
break;
}
const instance = this.instances[i];
if (instance.isAlive) {
instance.update();
}
if (instance.isAlive) {
i++;
} else {
this.instances.splice(i, 1);
}
}
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
get(func?: Function) {
return func == null
? this.instances.filter(a => a.isAlive)
: this.instances.filter(a => a.func === func && a.isAlive);
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
removeAll() {
this.instances.forEach(a => {
a.remove();
});
this.instances = [];
this.isRemovingAllInstances = true;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
MethodDeclaration
|
enablePriority() {
this.isPriorityEnabled = true;
}
|
abagames/petit-game-lib
|
src/pgl/simpleGameActor.ts
|
TypeScript
|
ClassDeclaration
|
export declare class FocusTrapZone extends BaseComponent<IFocusTrapZoneProps, {}> implements IFocusTrapZone {
private static _focusStack;
private _root;
private _firstBumper;
private _lastBumper;
private _hasFocus;
private _previouslyFocusedElementOutsideTrapZone;
private _previouslyFocusedElementInTrapZone?;
private _hasFocusHandler;
private _hasClickHandler;
componentDidMount(): void;
componentWillReceiveProps(nextProps: IFocusTrapZoneProps): void;
componentDidUpdate(prevProps: IFocusTrapZoneProps): void;
componentWillUnmount(): void;
render(): JSX.Element;
focus(): void;
private _focusAsync(element);
private _onRootFocus;
private _onRootBlur;
private _onFirstBumperFocus;
private _onLastBumperFocus;
private _onBumperFocus;
private _bringFocusIntoZone();
private _returnFocusToInitiator();
private _updateEventHandlers(newProps);
private _onFocusCapture;
private _isBumper(element);
private _forceFocusInTrap(ev);
private _forceClickInTrap(ev);
}
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
MethodDeclaration
|
componentDidMount(): void;
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
MethodDeclaration
|
componentWillReceiveProps(nextProps: IFocusTrapZoneProps): void;
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
MethodDeclaration
|
componentDidUpdate(prevProps: IFocusTrapZoneProps): void;
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
MethodDeclaration
|
componentWillUnmount(): void;
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
MethodDeclaration
|
focus(): void;
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
MethodDeclaration
|
private _focusAsync(element);
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
MethodDeclaration
|
private _bringFocusIntoZone();
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
MethodDeclaration
|
private _returnFocusToInitiator();
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
MethodDeclaration
|
private _updateEventHandlers(newProps);
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
MethodDeclaration
|
private _isBumper(element);
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
MethodDeclaration
|
private _forceFocusInTrap(ev);
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
MethodDeclaration
|
private _forceClickInTrap(ev);
|
sanket-berde/apexo
|
node_modules/office-ui-fabric-react/lib-amd/components/FocusTrapZone/FocusTrapZone.d.ts
|
TypeScript
|
ArrowFunction
|
(resolve) => {this.resolve = resolve;}
|
Jde-cpp/TwsWebsite
|
control/src/lib/pages/watch/watch.ts
|
TypeScript
|
ArrowFunction
|
(value)=>
{
this.tws.watchs().then( (names)=>
{
names.push( "" );
this.names = names;
this.resolve( true );
} ).catch( (e)=>{this.cnsle.error(e.message, e); });
}
|
Jde-cpp/TwsWebsite
|
control/src/lib/pages/watch/watch.ts
|
TypeScript
|
ArrowFunction
|
(names)=>
{
names.push( "" );
this.names = names;
this.resolve( true );
}
|
Jde-cpp/TwsWebsite
|
control/src/lib/pages/watch/watch.ts
|
TypeScript
|
ArrowFunction
|
(e)=>{this.cnsle.error(e.message, e); }
|
Jde-cpp/TwsWebsite
|
control/src/lib/pages/watch/watch.ts
|
TypeScript
|
ClassDeclaration
|
@Component( {selector: 'watch.main-content.mat-drawer-container', styleUrls: ['watch.css'], templateUrl: './watch.html'} )
export class WatchComponent implements AfterViewInit, OnInit, OnDestroy
{
constructor( private tws : TwsService, private componentPageTitle:ComponentPageTitle, @Inject('IProfile') private profileService: IProfile, @Inject('IErrorService') private cnsle: IErrorService )
{}
ngOnInit()
{
this.componentPageTitle.title = this.componentPageTitle.title ? this.componentPageTitle.title+" | Watch" : "Watch";
this.watchPromise = new Promise<boolean>( (resolve) => {this.resolve = resolve;} );
};
ngOnDestroy()
{
this.profile.save();
}
ngAfterViewInit():void
{
this.profile.loadedPromise.then( (value)=>
{
this.tws.watchs().then( (names)=>
{
names.push( "" );
this.names = names;
this.resolve( true );
} ).catch( (e)=>{this.cnsle.error(e.message, e); });
});
}
names:string[];
names2:string[];
profile = new Settings<PageSettings>( PageSettings, "WatchComponent", this.profileService );
private resolve: Function|null = null;
watchPromise:Promise<boolean>;
}
|
Jde-cpp/TwsWebsite
|
control/src/lib/pages/watch/watch.ts
|
TypeScript
|
ClassDeclaration
|
class PageSettings
{
assign( value:PageSettings ){ this.sort = value.sort; }
sort:Sort = {active: "id", direction: "asc"};
}
|
Jde-cpp/TwsWebsite
|
control/src/lib/pages/watch/watch.ts
|
TypeScript
|
MethodDeclaration
|
ngOnInit()
{
this.componentPageTitle.title = this.componentPageTitle.title ? this.componentPageTitle.title+" | Watch" : "Watch";
this.watchPromise = new Promise<boolean>( (resolve) => {this.resolve = resolve;} );
}
|
Jde-cpp/TwsWebsite
|
control/src/lib/pages/watch/watch.ts
|
TypeScript
|
MethodDeclaration
|
ngOnDestroy()
{
this.profile.save();
}
|
Jde-cpp/TwsWebsite
|
control/src/lib/pages/watch/watch.ts
|
TypeScript
|
MethodDeclaration
|
ngAfterViewInit():void
{
this.profile.loadedPromise.then( (value)=>
{
this.tws.watchs().then( (names)=>
{
names.push( "" );
this.names = names;
this.resolve( true );
} ).catch( (e)=>{this.cnsle.error(e.message, e); });
});
}
|
Jde-cpp/TwsWebsite
|
control/src/lib/pages/watch/watch.ts
|
TypeScript
|
MethodDeclaration
|
assign( value:PageSettings ){ this.sort = value.sort; }
|
Jde-cpp/TwsWebsite
|
control/src/lib/pages/watch/watch.ts
|
TypeScript
|
ClassDeclaration
|
export default class ElementsInspector extends Component<{
onElementExpanded: (key: ElementID, deep: boolean) => void;
onElementSelected: (key: ElementID) => void;
onElementHovered:
| ((key: ElementID | undefined | null) => any)
| undefined
| null;
onValueChanged: ((path: Array<string>, val: any) => any) | undefined | null;
selected: ElementID | undefined | null;
focused?: ElementID | undefined | null;
searchResults?: ElementSearchResultSet | undefined | null;
root: ElementID | undefined | null;
elements: {[key: string]: Element};
useAppSidebar?: boolean;
alternateRowColor?: boolean;
contextMenuExtensions?: Array<ContextMenuExtension>;
decorateRow?: DecorateRow;
}> {
static defaultProps = {
alternateRowColor: true,
};
render() {
const {
selected,
focused,
elements,
root,
onElementExpanded,
onElementSelected,
onElementHovered,
searchResults,
alternateRowColor,
contextMenuExtensions,
decorateRow,
} = this.props;
return (
<Elements
onElementExpanded={onElementExpanded}
onElementSelected={onElementSelected}
onElementHovered={onElementHovered}
selected={selected}
focused={focused}
searchResults={searchResults}
root={root}
elements={elements}
alternateRowColor={alternateRowColor}
contextMenuExtensions={contextMenuExtensions}
decorateRow={decorateRow}
/>
);
}
}
|
EricAtPlanGrid/flipper
|
src/ui/components/elements-inspector/ElementsInspector.tsx
|
TypeScript
|
TypeAliasDeclaration
|
export type ElementID = string;
|
EricAtPlanGrid/flipper
|
src/ui/components/elements-inspector/ElementsInspector.tsx
|
TypeScript
|
TypeAliasDeclaration
|
export type ElementSearchResultSet = {
query: string;
matches: Set<ElementID>;
};
|
EricAtPlanGrid/flipper
|
src/ui/components/elements-inspector/ElementsInspector.tsx
|
TypeScript
|
TypeAliasDeclaration
|
export type ElementData = {
[name: string]: {
[key: string]:
| string
| number
| boolean
| {
__type__: string;
value: any;
};
};
};
|
EricAtPlanGrid/flipper
|
src/ui/components/elements-inspector/ElementsInspector.tsx
|
TypeScript
|
TypeAliasDeclaration
|
export type ElementAttribute = {
name: string;
value: string;
};
|
EricAtPlanGrid/flipper
|
src/ui/components/elements-inspector/ElementsInspector.tsx
|
TypeScript
|
TypeAliasDeclaration
|
export type ElementExtraInfo = {
linkedNode?: string; // id of linked node in opposite tree
expandWithParent?: boolean;
};
|
EricAtPlanGrid/flipper
|
src/ui/components/elements-inspector/ElementsInspector.tsx
|
TypeScript
|
TypeAliasDeclaration
|
export type Element = {
id: ElementID;
name: string;
expanded: boolean;
children: Array<ElementID>;
attributes: Array<ElementAttribute>;
data: ElementData;
decoration: string;
extraInfo: ElementExtraInfo;
};
|
EricAtPlanGrid/flipper
|
src/ui/components/elements-inspector/ElementsInspector.tsx
|
TypeScript
|
MethodDeclaration
|
render() {
const {
selected,
focused,
elements,
root,
onElementExpanded,
onElementSelected,
onElementHovered,
searchResults,
alternateRowColor,
contextMenuExtensions,
decorateRow,
} = this.props;
return (
<Elements
onElementExpanded={onElementExpanded}
onElementSelected={onElementSelected}
onElementHovered={onElementHovered}
selected={selected}
focused={focused}
searchResults={searchResults}
root={root}
elements={elements}
alternateRowColor={alternateRowColor}
contextMenuExtensions={contextMenuExtensions}
decorateRow={decorateRow}
/>
);
}
|
EricAtPlanGrid/flipper
|
src/ui/components/elements-inspector/ElementsInspector.tsx
|
TypeScript
|
InterfaceDeclaration
|
/**
* (experimental) Represents an integration to an API Route.
*
* @experimental
*/
export interface IIntegration extends IResource {
/**
* (experimental) Id of the integration.
*
* @experimental
* @attribute true
*/
readonly integrationId: string;
}
|
Anupama08/CodeDeployGitHubDemo
|
node_modules/@aws-cdk/aws-apigatewayv2/lib/common/integration.d.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('renders per snapshot', () => {
const applicationTitle = 'THE_APPLICATION_TITLE';
const deps = {
textContent: {
applicationTitle,
},
} as HeaderDeps;
const wrapper = shallow(<Header deps={deps} />);
expect(wrapper.getElement()).toMatchSnapshot();
});
}
|
annikakouhia/accessibility-insights-web
|
src/tests/unit/tests/common/components/header.test.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const applicationTitle = 'THE_APPLICATION_TITLE';
const deps = {
textContent: {
applicationTitle,
},
} as HeaderDeps;
const wrapper = shallow(<Header deps={deps} />);
expect(wrapper.getElement()).toMatchSnapshot();
}
|
annikakouhia/accessibility-insights-web
|
src/tests/unit/tests/common/components/header.test.tsx
|
TypeScript
|
FunctionDeclaration
|
export default async function isAllowedToManageTag(clientId: number, tagId: number) {
return await isAllowed(clientId, getTagResourceId(tagId), 'addViewer') ||
await isClientManager(clientId);
}
|
v2land/v2land-redstone
|
api/services/AccessControlService/TagAccessControl/isAllowedToManageTag.ts
|
TypeScript
|
ArrowFunction
|
() => {
type avenger = {
name: string,
weapon: string,
};
const iroman: avenger = {
name: 'Ironman',
weapon: 'Armorsuit',
};
const captainAmerica: avenger = {
name: 'CApitán América',
weapon: 'Escudo',
};
const thor: avenger = {
name: 'Thor',
weapon: 'Mjornir',
};
const avengers: avenger[] = [iroman, thor, captainAmerica];
for (const avenger of avengers) {
console.log(avenger.name, avenger.weapon)
};
}
|
MaiaRojas/types-typescript
|
ES6/for-of.ts
|
TypeScript
|
TypeAliasDeclaration
|
type avenger = {
name: string,
weapon: string,
};
|
MaiaRojas/types-typescript
|
ES6/for-of.ts
|
TypeScript
|
FunctionDeclaration
|
export function getNativeText(textView: textViewModule.TextView): string {
return textView.ios.text;
}
|
ATphobia22/NativeScript
|
tests/app/ui/text-view/text-view-tests-native.ios.ts
|
TypeScript
|
FunctionDeclaration
|
export function getNativeHint(textView: textViewModule.TextView): string {
// There is no native hint so we use a hack and sett 22% opaque text.
if ((<any>textView)._isShowingHint) {
return textView.ios.text;
}
return "";
}
|
ATphobia22/NativeScript
|
tests/app/ui/text-view/text-view-tests-native.ios.ts
|
TypeScript
|
FunctionDeclaration
|
export function getNativeEditable(textView: textViewModule.TextView): boolean {
return textView.ios.editable;
}
|
ATphobia22/NativeScript
|
tests/app/ui/text-view/text-view-tests-native.ios.ts
|
TypeScript
|
FunctionDeclaration
|
export function getNativeFontSize(textView: textViewModule.TextView): number {
return textView.ios.font.pointSize;
}
|
ATphobia22/NativeScript
|
tests/app/ui/text-view/text-view-tests-native.ios.ts
|
TypeScript
|
FunctionDeclaration
|
export function getNativeColor(textView: textViewModule.TextView): colorModule.Color {
return getColor(textView.ios.textColor);
}
|
ATphobia22/NativeScript
|
tests/app/ui/text-view/text-view-tests-native.ios.ts
|
TypeScript
|
FunctionDeclaration
|
export function getNativeBackgroundColor(textView: textViewModule.TextView): colorModule.Color {
return getColor(textView.ios.backgroundColor);
}
|
ATphobia22/NativeScript
|
tests/app/ui/text-view/text-view-tests-native.ios.ts
|
TypeScript
|
FunctionDeclaration
|
export function getNativeTextAlignment(textView: textViewModule.TextView): string {
switch (textView.ios.textAlignment) {
case NSTextAlignment.Left:
return enums.TextAlignment.left;
case NSTextAlignment.Center:
return enums.TextAlignment.center;
case NSTextAlignment.Right:
return enums.TextAlignment.right;
default:
return "unexpected value";
}
}
|
ATphobia22/NativeScript
|
tests/app/ui/text-view/text-view-tests-native.ios.ts
|
TypeScript
|
FunctionDeclaration
|
export function typeTextNatively(textView: textViewModule.TextView, text: string): void {
textView.ios.text = text;
// Setting the text will not trigger the delegate method, so we have to do it by hand.
textView.ios.delegate.textViewDidEndEditing(textView.ios);
}
|
ATphobia22/NativeScript
|
tests/app/ui/text-view/text-view-tests-native.ios.ts
|
TypeScript
|
ArrowFunction
|
(item) => MigrationPayload.OtpParameters.fromObject(item)
|
rm-hull/zaup2
|
src/proto/migration_payload.ts
|
TypeScript
|
ArrowFunction
|
(item: MigrationPayload.OtpParameters) => item.toObject()
|
rm-hull/zaup2
|
src/proto/migration_payload.ts
|
TypeScript
|
ArrowFunction
|
(item: MigrationPayload.OtpParameters) =>
item.serialize(writer)
|
rm-hull/zaup2
|
src/proto/migration_payload.ts
|
TypeScript
|
ArrowFunction
|
() =>
pb_1.Message.addToRepeatedWrapperField(
message,
1,
MigrationPayload.OtpParameters.deserialize(reader),
MigrationPayload.OtpParameters
)
|
rm-hull/zaup2
|
src/proto/migration_payload.ts
|
TypeScript
|
ClassDeclaration
|
export class MigrationPayload extends pb_1.Message {
constructor(
data?:
| any[]
| {
otp_parameters?: MigrationPayload.OtpParameters[];
version?: number;
batch_size?: number;
batch_index?: number;
batch_id?: number;
}
) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], []);
if (!Array.isArray(data) && typeof data == "object") {
if ("otp_parameters" in data && data.otp_parameters != undefined) {
this.otp_parameters = data.otp_parameters;
}
if ("version" in data && data.version != undefined) {
this.version = data.version;
}
if ("batch_size" in data && data.batch_size != undefined) {
this.batch_size = data.batch_size;
}
if ("batch_index" in data && data.batch_index != undefined) {
this.batch_index = data.batch_index;
}
if ("batch_id" in data && data.batch_id != undefined) {
this.batch_id = data.batch_id;
}
}
}
get otp_parameters() {
return pb_1.Message.getRepeatedWrapperField(
this,
MigrationPayload.OtpParameters,
1
) as MigrationPayload.OtpParameters[];
}
set otp_parameters(value: MigrationPayload.OtpParameters[]) {
pb_1.Message.setRepeatedWrapperField(this, 1, value);
}
get version() {
return pb_1.Message.getField(this, 2) as number;
}
set version(value: number) {
pb_1.Message.setField(this, 2, value);
}
get batch_size() {
return pb_1.Message.getField(this, 3) as number;
}
set batch_size(value: number) {
pb_1.Message.setField(this, 3, value);
}
get batch_index() {
return pb_1.Message.getField(this, 4) as number;
}
set batch_index(value: number) {
pb_1.Message.setField(this, 4, value);
}
get batch_id() {
return pb_1.Message.getField(this, 5) as number;
}
set batch_id(value: number) {
pb_1.Message.setField(this, 5, value);
}
static fromObject(data: {
otp_parameters?: ReturnType<typeof MigrationPayload.OtpParameters.prototype.toObject>[];
version?: number;
batch_size?: number;
batch_index?: number;
batch_id?: number;
}) {
const message = new MigrationPayload({});
if (data.otp_parameters != null) {
message.otp_parameters = data.otp_parameters.map((item) => MigrationPayload.OtpParameters.fromObject(item));
}
if (data.version != null) {
message.version = data.version;
}
if (data.batch_size != null) {
message.batch_size = data.batch_size;
}
if (data.batch_index != null) {
message.batch_index = data.batch_index;
}
if (data.batch_id != null) {
message.batch_id = data.batch_id;
}
return message;
}
toObject() {
const data: {
otp_parameters?: ReturnType<typeof MigrationPayload.OtpParameters.prototype.toObject>[];
version?: number;
batch_size?: number;
batch_index?: number;
batch_id?: number;
} = {};
if (this.otp_parameters != null) {
data.otp_parameters = this.otp_parameters.map((item: MigrationPayload.OtpParameters) => item.toObject());
}
if (this.version != null) {
data.version = this.version;
}
if (this.batch_size != null) {
data.batch_size = this.batch_size;
}
if (this.batch_index != null) {
data.batch_index = this.batch_index;
}
if (this.batch_id != null) {
data.batch_id = this.batch_id;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.otp_parameters !== undefined)
writer.writeRepeatedMessage(1, this.otp_parameters, (item: MigrationPayload.OtpParameters) =>
item.serialize(writer)
);
if (this.version !== undefined) writer.writeInt32(2, this.version);
if (this.batch_size !== undefined) writer.writeInt32(3, this.batch_size);
if (this.batch_index !== undefined) writer.writeInt32(4, this.batch_index);
if (this.batch_id !== undefined) writer.writeInt32(5, this.batch_id);
if (!w) return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MigrationPayload {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes),
message = new MigrationPayload();
while (reader.nextField()) {
if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.otp_parameters, () =>
pb_1.Message.addToRepeatedWrapperField(
message,
1,
MigrationPayload.OtpParameters.deserialize(reader),
MigrationPayload.OtpParameters
)
);
break;
case 2:
message.version = reader.readInt32();
break;
case 3:
message.batch_size = reader.readInt32();
break;
case 4:
message.batch_index = reader.readInt32();
break;
case 5:
message.batch_id = reader.readInt32();
break;
default:
reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): MigrationPayload {
return MigrationPayload.deserialize(bytes);
}
}
|
rm-hull/zaup2
|
src/proto/migration_payload.ts
|
TypeScript
|
ClassDeclaration
|
export class OtpParameters extends pb_1.Message {
constructor(
data?:
| any[]
| {
secret?: Uint8Array;
name?: string;
issuer?: string;
algorithm?: MigrationPayload.Algorithm;
digits?: MigrationPayload.DigitCount;
type?: MigrationPayload.OtpType;
counter?: number;
}
) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []);
if (!Array.isArray(data) && typeof data == "object") {
if ("secret" in data && data.secret != undefined) {
this.secret = data.secret;
}
if ("name" in data && data.name != undefined) {
this.name = data.name;
}
if ("issuer" in data && data.issuer != undefined) {
this.issuer = data.issuer;
}
if ("algorithm" in data && data.algorithm != undefined) {
this.algorithm = data.algorithm;
}
if ("digits" in data && data.digits != undefined) {
this.digits = data.digits;
}
if ("type" in data && data.type != undefined) {
this.type = data.type;
}
if ("counter" in data && data.counter != undefined) {
this.counter = data.counter;
}
}
}
get secret() {
return pb_1.Message.getField(this, 1) as Uint8Array;
}
set secret(value: Uint8Array) {
pb_1.Message.setField(this, 1, value);
}
get name() {
return pb_1.Message.getField(this, 2) as string;
}
set name(value: string) {
pb_1.Message.setField(this, 2, value);
}
get issuer() {
return pb_1.Message.getField(this, 3) as string;
}
set issuer(value: string) {
pb_1.Message.setField(this, 3, value);
}
get algorithm() {
return pb_1.Message.getField(this, 4) as MigrationPayload.Algorithm;
}
set algorithm(value: MigrationPayload.Algorithm) {
pb_1.Message.setField(this, 4, value);
}
get digits() {
return pb_1.Message.getField(this, 5) as MigrationPayload.DigitCount;
}
set digits(value: MigrationPayload.DigitCount) {
pb_1.Message.setField(this, 5, value);
}
get type() {
return pb_1.Message.getField(this, 6) as MigrationPayload.OtpType;
}
set type(value: MigrationPayload.OtpType) {
pb_1.Message.setField(this, 6, value);
}
get counter() {
return pb_1.Message.getField(this, 7) as number;
}
set counter(value: number) {
pb_1.Message.setField(this, 7, value);
}
static fromObject(data: {
secret?: Uint8Array;
name?: string;
issuer?: string;
algorithm?: MigrationPayload.Algorithm;
digits?: MigrationPayload.DigitCount;
type?: MigrationPayload.OtpType;
counter?: number;
}) {
const message = new OtpParameters({});
if (data.secret != null) {
message.secret = data.secret;
}
if (data.name != null) {
message.name = data.name;
}
if (data.issuer != null) {
message.issuer = data.issuer;
}
if (data.algorithm != null) {
message.algorithm = data.algorithm;
}
if (data.digits != null) {
message.digits = data.digits;
}
if (data.type != null) {
message.type = data.type;
}
if (data.counter != null) {
message.counter = data.counter;
}
return message;
}
toObject() {
const data: {
secret?: Uint8Array;
name?: string;
issuer?: string;
algorithm?: MigrationPayload.Algorithm;
digits?: MigrationPayload.DigitCount;
type?: MigrationPayload.OtpType;
counter?: number;
} = {};
if (this.secret != null) {
data.secret = this.secret;
}
if (this.name != null) {
data.name = this.name;
}
if (this.issuer != null) {
data.issuer = this.issuer;
}
if (this.algorithm != null) {
data.algorithm = this.algorithm;
}
if (this.digits != null) {
data.digits = this.digits;
}
if (this.type != null) {
data.type = this.type;
}
if (this.counter != null) {
data.counter = this.counter;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.secret !== undefined) writer.writeBytes(1, this.secret);
if (typeof this.name === "string" && this.name.length) writer.writeString(2, this.name);
if (typeof this.issuer === "string" && this.issuer.length) writer.writeString(3, this.issuer);
if (this.algorithm !== undefined) writer.writeEnum(4, this.algorithm);
if (this.digits !== undefined) writer.writeEnum(5, this.digits);
if (this.type !== undefined) writer.writeEnum(6, this.type);
if (this.counter !== undefined) writer.writeInt64(7, this.counter);
if (!w) return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): OtpParameters {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes),
message = new OtpParameters();
while (reader.nextField()) {
if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) {
case 1:
message.secret = reader.readBytes();
break;
case 2:
message.name = reader.readString();
break;
case 3:
message.issuer = reader.readString();
break;
case 4:
message.algorithm = reader.readEnum();
break;
case 5:
message.digits = reader.readEnum();
break;
case 6:
message.type = reader.readEnum();
break;
case 7:
message.counter = reader.readInt64();
break;
default:
reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): OtpParameters {
return OtpParameters.deserialize(bytes);
}
}
|
rm-hull/zaup2
|
src/proto/migration_payload.ts
|
TypeScript
|
EnumDeclaration
|
export enum Algorithm {
ALGORITHM_UNSPECIFIED = 0,
ALGORITHM_SHA1 = 1,
ALGORITHM_SHA256 = 2,
ALGORITHM_SHA512 = 3,
ALGORITHM_MD5 = 4,
}
|
rm-hull/zaup2
|
src/proto/migration_payload.ts
|
TypeScript
|
EnumDeclaration
|
export enum DigitCount {
DIGIT_COUNT_UNSPECIFIED = 0,
DIGIT_COUNT_SIX = 1,
DIGIT_COUNT_EIGHT = 2,
}
|
rm-hull/zaup2
|
src/proto/migration_payload.ts
|
TypeScript
|
EnumDeclaration
|
export enum OtpType {
OTP_TYPE_UNSPECIFIED = 0,
OTP_TYPE_HOTP = 1,
OTP_TYPE_TOTP = 2,
}
|
rm-hull/zaup2
|
src/proto/migration_payload.ts
|
TypeScript
|
MethodDeclaration
|
static fromObject(data: {
otp_parameters?: ReturnType<typeof MigrationPayload.OtpParameters.prototype.toObject>[];
version?: number;
batch_size?: number;
batch_index?: number;
batch_id?: number;
}) {
const message = new MigrationPayload({});
if (data.otp_parameters != null) {
message.otp_parameters = data.otp_parameters.map((item) => MigrationPayload.OtpParameters.fromObject(item));
}
if (data.version != null) {
message.version = data.version;
}
if (data.batch_size != null) {
message.batch_size = data.batch_size;
}
if (data.batch_index != null) {
message.batch_index = data.batch_index;
}
if (data.batch_id != null) {
message.batch_id = data.batch_id;
}
return message;
}
|
rm-hull/zaup2
|
src/proto/migration_payload.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.