Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
7 年前
差異永不過期
清除
匯出
分享
解釋
56 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
62 行
全部複製
39 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
46 行
全部複製
複製
已複製
複製
已複製
import { inject as service } from
'
@ember
/service
'
;
import { inject as service } from
"
@ember
-decorators
/service
"
;
import Component from '@ember/component';
import Component from '@ember/component';
複製
已複製
複製
已複製
import {
computed } from
'
@ember/object
'
;
import {
action, wrapComputed,
computed } from
"
@ember/object
"
;
import { isEmpty } from '@ember/utils';
import { isEmpty } from '@ember/utils';
import { task } from 'ember-concurrency';
import { task } from 'ember-concurrency';
import { filterByFilePath } from '../utils';
import { filterByFilePath } from '../utils';
複製
已複製
複製
已複製
export default
Component.
extend
(
{
export default
class AddonSourceUsagesComponent
extend
s Component
{
visibleUsageCount
:
25
,
visibleUsageCount
=
25
;
showUsages
=
false
;
showUsages
:
false
,
usages
=
null
;
regex
=
false
;
usages
:
null
,
fileFilter
=
null
;
regex
:
false
,
fileFilter
:
null
,
複製
已複製
複製
已複製
codeSearch
: service(),
@service
codeSearch
;
複製
已複製
複製
已複製
visibleUsages:
computed('visibleUsageCount', 'usages'
, function
() {
@
computed('visibleUsageCount', 'usages'
)
get visibleUsages
() {
return this.usages.slice(0, this.visibleUsageCount);
return this.usages.slice(0, this.visibleUsageCount);
複製
已複製
複製
已複製
}
),
}
複製
已複製
複製
已複製
moreUsages:
computed('visibleUsageCount', 'usages'
, function
() {
@
computed('visibleUsageCount', 'usages'
)
get moreUsages
() {
return this.visibleUsageCount < this.usages.length;
return this.visibleUsageCount < this.usages.length;
複製
已複製
複製
已複製
}
),
}
複製
已複製
複製
已複製
fetchUsages:
task(function* () {
@(
task(function* () {
let usages = yield this.codeSearch.usages.perform(this.addon.id, this.query, this.regex);
let usages = yield this.codeSearch.usages.perform(this.addon.id, this.query, this.regex);
this.set('usages', filterByFilePath(usages, this.fileFilter));
this.set('usages', filterByFilePath(usages, this.fileFilter));
複製
已複製
複製
已複製
}).drop()
,
}).drop()
)
fetchUsages
;
actions: {
toggleUsages() {
this.toggleProperty('showUsages');
if (this.showUsages && this.usages === null) {
this.
fetchUsages
.perform();
}
},
複製
已複製
複製
已複製
viewMore
() {
@action
let newUsageCount =
this.
visibleUsageCount + 25;
toggleUsages
() {
this.
set('visibleUsageCount', newUsageCount
);
this.toggleProperty('showUsages');
if (
this.
showUsages && this.usages === null) {
this.
fetchUsages.perform(
);
}
}
}
}
複製
已複製
複製
已複製
});
複製
已複製
複製
已複製
fun
ction
filterByFilePath(usages, filterTerm) {
@a
ction
if (isEmpty(filterTerm)
) {
viewMore(
) {
return usages;
let newUsageCount = this.visibleUsageCount + 25;
}
this.set('visibleUsageCount', newUsageCount);
let filterRegex;
try {
filterRegex = new RegExp(filterTerm);
} catch(e) {
return [];
}
}
複製
已複製
複製
已複製
return usages.filter((usage) => {
return usage.filename.match(filterRegex);
});
}
}
已保存差異
原始文本
開啟檔案
import { inject as service } from '@ember/service'; import Component from '@ember/component'; import { computed } from '@ember/object'; import { isEmpty } from '@ember/utils'; import { task } from 'ember-concurrency'; import { filterByFilePath } from '../utils'; export default Component.extend({ visibleUsageCount: 25, showUsages: false, usages: null, regex: false, fileFilter: null, codeSearch: service(), visibleUsages: computed('visibleUsageCount', 'usages', function() { return this.usages.slice(0, this.visibleUsageCount); }), moreUsages: computed('visibleUsageCount', 'usages', function() { return this.visibleUsageCount < this.usages.length; }), fetchUsages: task(function* () { let usages = yield this.codeSearch.usages.perform(this.addon.id, this.query, this.regex); this.set('usages', filterByFilePath(usages, this.fileFilter)); }).drop(), actions: { toggleUsages() { this.toggleProperty('showUsages'); if (this.showUsages && this.usages === null) { this.fetchUsages.perform(); } }, viewMore() { let newUsageCount = this.visibleUsageCount + 25; this.set('visibleUsageCount', newUsageCount); } } }); function filterByFilePath(usages, filterTerm) { if (isEmpty(filterTerm)) { return usages; } let filterRegex; try { filterRegex = new RegExp(filterTerm); } catch(e) { return []; } return usages.filter((usage) => { return usage.filename.match(filterRegex); }); }
更改後文本
開啟檔案
import { inject as service } from "@ember-decorators/service"; import Component from '@ember/component'; import { action, wrapComputed, computed } from "@ember/object"; import { isEmpty } from '@ember/utils'; import { task } from 'ember-concurrency'; import { filterByFilePath } from '../utils'; export default class AddonSourceUsagesComponent extends Component { visibleUsageCount = 25; showUsages = false; usages = null; regex = false; fileFilter = null; @service codeSearch; @computed('visibleUsageCount', 'usages') get visibleUsages() { return this.usages.slice(0, this.visibleUsageCount); } @computed('visibleUsageCount', 'usages') get moreUsages() { return this.visibleUsageCount < this.usages.length; } @(task(function* () { let usages = yield this.codeSearch.usages.perform(this.addon.id, this.query, this.regex); this.set('usages', filterByFilePath(usages, this.fileFilter)); }).drop()) fetchUsages; @action toggleUsages() { this.toggleProperty('showUsages'); if (this.showUsages && this.usages === null) { this.fetchUsages.perform(); } } @action viewMore() { let newUsageCount = this.visibleUsageCount + 25; this.set('visibleUsageCount', newUsageCount); } }
尋找差異