本文整理汇总了TypeScript中dojo-shim/Map.get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get函数的具体用法?TypeScript get怎么用?TypeScript get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
return function(this: TrackableSubCollection<T, O, U, C>, idOrIds?: string | string[]) {
if (idOrIds || !instanceStateMap.get(this).isTracking) {
return observe.call(this, idOrIds);
}
else {
return instanceStateMap.get(this).observable;
}
};
开发者ID:maier49,项目名称:store,代码行数:8,代码来源:createTrackableMixin.ts
示例2:
updateAndAddIds.forEach(function(id, itemIndex) {
if (newIndex.has(id) && !state.idToIndex.has(id)) {
if (itemIndex < update.updates.length) {
trackedUpdates.push(update.updates[itemIndex]);
}
else {
trackedAdds.push(update.adds[itemIndex - update.updates.length]);
}
trackedAdds.push();
const index = newIndex.get(id);
addedToTracked.push({
item: newData[index],
id: id,
index: index
});
}
});
开发者ID:maier49,项目名称:store,代码行数:17,代码来源:createTrackableMixin.ts
示例3: if
updateIds.forEach(function(id, updateIndex) {
if (!newIndex.has(id) && state.idToIndex.has(id)) {
trackedUpdates.push(update.updates[updateIndex]);
const index = state.idToIndex.get(id);
removedFromTracked.push({
item: update.updates[updateIndex],
previousIndex: index,
id: id
});
}
else if (newIndex.has(id) && state.idToIndex.has(id)) {
trackedUpdates.push(update.updates[updateIndex]);
const previouxIndex = state.idToIndex.get(id);
const index = newIndex.get(id);
movedInTracked.push({
item: newData[index],
id: id,
previousIndex: previouxIndex,
index: index
});
}
});
开发者ID:maier49,项目名称:store,代码行数:22,代码来源:createTrackableMixin.ts
示例4: get
const idToWidgetMap = new Map<string, TodoItem>();
const widgetToIdMap = new WeakMap<TodoItem, string>();
interface TodoRegistryOptions {
widgetStore: MemoryStore<Object>;
}
interface TodoRegistry {
get(id: string): Promise<TodoItem>;
identify(value: TodoItem): string;
widgetStore?: MemoryStore<Object>;
}
const todoRegistryFactory = compose({
get(id: string): Promise<TodoItem> {
let widget: TodoItem = idToWidgetMap.get(id);
if (!widget) {
widget = createTodoItem({id, stateFrom: this.widgetStore});
widgetToIdMap.set(widget, id);
idToWidgetMap.set(id, widget);
}
return Promise.resolve(widget);
},
identify(value: TodoItem): string {
return widgetToIdMap.get(value);
}
}, function (todoRegistry: TodoRegistry, options: TodoRegistryOptions) {
if (options) {
todoRegistry.widgetStore = options.widgetStore;
}
});
开发者ID:Tomdye,项目名称:dojo2-todo-mvc,代码行数:31,代码来源:createTodoRegistry.ts
示例5: stackSelector
const createSigned = (): [ Record, Record ] => {
return [
// Record negative and positive columns separately.
{ originalPoints: [], columns: [], isNegative: true, relativeValue: 0, value: 0 },
{ originalPoints: [], columns: [], isNegative: false, relativeValue: 0, value: 0 }
];
};
for (const point of originalPoints) {
const { datum } = point;
const { input, relativeValue, value } = datum;
// Note that the ordering of the stacks is determined by the original sort order, as is the
// ordering of nodes within the stack.
const stack = stackSelector(input);
const signed = stacks.get(stack) || createSigned();
const record = relativeValue < 0 ? signed[0] : signed[1];
if (!stacks.has(stack)) {
stacks.set(stack, signed);
}
record.originalPoints.push(point);
record.columns.push(datum);
record.relativeValue += relativeValue;
record.value += value;
if (record.relativeValue < mostNegativeRelValue) {
mostNegativeRelValue = record.relativeValue;
}
else if (record.relativeValue > mostPositiveRelValue) {
mostPositiveRelValue = record.relativeValue;
开发者ID:novemberborn,项目名称:dojo2-dataviz,代码行数:31,代码来源:createStackedColumnChart.ts
示例6: method
assert.doesNotThrow(function () {
const method = map.get('method');
method && method();
});
开发者ID:GionHobby,项目名称:core,代码行数:4,代码来源:aspect.ts
示例7: beforeEach
'with maps': {
beforeEach() {
methodSpy = sinon.spy(function (a: number) {
return a + 1;
});
map = new Map([ [ 'method', methodSpy ] ]);
},
'.before': {
'return value passed as arguments'() {
let aspectSpy = createBeforeSpy();
aspect.before(map, 'method', aspectSpy);
const method = map.get('method');
method && method(0);
assert.isTrue(aspectSpy.calledBefore(methodSpy));
assert.isTrue(aspectSpy.calledOnce);
assert.isTrue(methodSpy.calledOnce);
assert.strictEqual(aspectSpy.lastCall.args[0], 0);
assert.strictEqual(methodSpy.lastCall.args[0], 1);
assert.strictEqual(methodSpy.returnValues[0], 2);
},
'no return value from advising function'() {
let receivedArgs: string[] = [];
let beforeCalled = false;
map = new Map([ [ 'method', function (...args: string[]) {
receivedArgs = args;
} ] ]);
开发者ID:GionHobby,项目名称:core,代码行数:31,代码来源:aspect.ts
示例8: groupSelector
totalValue: number;
value: number;
y1: number;
}
const groups = new Map<G, Record>();
const createRecord = (): Record => {
return { originalPoints: [], columns: [], totalValue: 0, value: 0, y1: columnHeight };
};
for (const point of originalPoints) {
const { input, relativeValue, value } = point.datum;
// Note that the ordering of the groups is determined by the original sort order, as is the
// ordering of nodes within the group.
const group = groupSelector(input);
const record = groups.get(group) || createRecord();
if (!groups.has(group)) {
groups.set(group, record);
}
record.originalPoints.push(point);
record.columns.push(point.datum);
record.totalValue += value;
if (relativeValue < 0) {
record.value = Math.min(record.value, value);
}
else {
// Note that the expected value for mixed groups is undefined.
record.value = Math.max(record.value, value);
}
record.y1 = Math.min(record.y1, point.y1);
开发者ID:novemberborn,项目名称:dojo2-dataviz,代码行数:31,代码来源:createGroupedColumnChart.ts
注:本文中的dojo-shim/Map.get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论