本文整理匯總了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);
});