本文整理汇总了TypeScript中@ember/object.set函数的典型用法代码示例。如果您正苦于以下问题:TypeScript set函数的具体用法?TypeScript set怎么用?TypeScript set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
return function() {
let currentValue = get(obj, prop);
if (isPresent(values)) {
let currentIdx = values.indexOf(currentValue);
let nextIdx = nextIndex(get(values, 'length'), currentIdx);
return set(obj, prop, values[nextIdx]);
}
return set(obj, prop, !currentValue);
};
示例2: transitionTo
/*
@method transitionTo
@private
@param {String} name
*/
transitionTo(name) {
// POSSIBLE TODO: Remove this code and replace with
// always having direct reference to state objects
let pivotName = extractPivotName(name);
let state = this.currentState;
let transitionMapId = `${state.stateName}->${name}`;
do {
if (state.exit) {
state.exit(this);
}
state = state.parentState;
} while (!state[pivotName]);
let setups;
let enters;
let i;
let l;
let map = TransitionChainMap[transitionMapId];
if (map) {
setups = map.setups;
enters = map.enters;
state = map.state;
} else {
setups = [];
enters = [];
let path = splitOnDot(name);
for (i = 0, l = path.length; i < l; i++) {
state = state[path[i]];
if (state.enter) {
enters.push(state);
}
if (state.setup) {
setups.push(state);
}
}
TransitionChainMap[transitionMapId] = { setups, enters, state };
}
for (i = 0, l = enters.length; i < l; i++) {
enters[i].enter(this);
}
this.currentState = state;
if (this.hasRecord) {
set(this._record, 'currentState', state);
}
for (i = 0, l = setups.length; i < l; i++) {
setups[i].setup(this);
}
this.updateRecordArrays();
}
示例3: typeahead
/**
* Before we call onTypeahead, we cancel the last search task if available
* and save the new one
* @param text user typed text
*/
typeahead(text: string): PromiseOrTask<Array<string>> {
this.cancelTypeaheadTask();
const typeaheadTask = this.onTypeahead(text);
set(this, 'typeaheadTask', typeaheadTask);
return typeaheadTask;
}
示例4: get
const databaseInstance = (adapter: RealtimeDatabaseAdapter) => {
let database = get(adapter, 'database');
if (!database) {
const app = get(adapter, 'firebaseApp');
const databaseURL = get(adapter, 'databaseURL');
database = app.database(databaseURL);
set(adapter, 'database', database);
}
return database;
}
示例5: onSubmit
/**
* When user intents to perform a search
*/
onSubmit(): void {
if (this.inputText && this.inputText.trim().length > 0) {
// this will prevent search text from jitter,
// since inputText may differ from text, PWS will try to restore
// text since there was not a selection, but we will set text from the route
// at a later point. That will cause the search box to show for example:
// => car // press enter
// => somethingelse //after onSubmit
// => car // route sets car
set(this, 'text', this.inputText);
this.onSearch(this.inputText);
if (this.powerSelectApi) {
this.powerSelectApi.actions.close();
}
}
}
示例6: get
const getFirestore = (adapter: FirestoreAdapter) => {
let cachedFirestoreInstance = get(adapter, 'firestore');
if (!cachedFirestoreInstance) {
const app = get(adapter, 'firebaseApp');
cachedFirestoreInstance = app.firestore().then(firestore => {
const settings = get(adapter, 'settings');
firestore.settings(settings);
const enablePersistence = get(adapter, 'enablePersistence');
const fastboot = getOwner(adapter).lookup('service:fastboot');
if (enablePersistence && (fastboot == null || !fastboot.isFastBoot)) {
const persistenceSettings = get(adapter, 'persistenceSettings');
firestore.enablePersistence(persistenceSettings).catch(console.warn);
}
return firestore;
});
set(adapter, 'firestore', cachedFirestoreInstance);
}
return cachedFirestoreInstance;
};
示例7: set
const confirmOwner = (owner: IOwner, confirmedBy: string): IOwner['confirmedBy'] =>
set(owner, 'confirmedBy', confirmedBy || null);
示例8: finishedReloading
finishedReloading() {
this.isReloading = false;
if (this.hasRecord) {
set(this._record, 'isReloading', false);
}
}
示例9: startedReloading
startedReloading() {
this.isReloading = true;
if (this.hasRecord) {
set(this._record, 'isReloading', true);
}
}
示例10: run
let ret = run(function() {
return set(context, key, value);
});