IntroductionSourceItem
IntroductionSourceItem
クラスは紹介元に対して操作を行うためのメンバーを持っています。
継承
インスタンスプロパティ
length
追加されている全ての紹介元の数を示す数値です。
例
esmJSPlugin.sheetSave("businesscard").onSheetItemsMounted((screen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
console.log(introductionSourceItem.length); // 4
});
entityIds
追加されている全ての紹介元の ID を示す数値の配列です。
例
esmJSPlugin.sheetSave("businesscard").onSheetItemsMounted((screen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
console.log(introductionSourceItem.entityIds); // [1,2,3,4]
});
entityNames
追加されている全ての紹介元の名前を示す文字列の配列です。
esmJSPlugin.sheetSave("businesscard").onSheetItemsMounted((screen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
console.log(introductionSourceItem.entityNames); // ["佐藤", "佐々木"]
});
インスタンスメソッド
entityNamesInclude
紹介元に指定した名前が含まれているかどうかを判定します。
構文
entityNamesInclude(neme);
引数
name
紹介元の名前を示す文字列です。
返値
真偽値
例
esmJSPlugin.sheetSave("businesscard").onSheetItemsMounted((screen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
console.log(introductionSourceItem.entityNames); // ["佐藤", "佐々木"]
console.log(introductionSourceItem.entityNamesInclude("佐藤")); // true
});
entitiesInclude
紹介元に指定した id が含まれているかどうかを判定します。
構文
entitiesInclude(id);
引数
id
紹介元の ID を示す数値です。
返値
真偽値
例
esmJSPlugin.sheetSave("businesscard").onSheetItemsMounted((screen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
console.log(introductionSourceItem.entityIds); // [1,2,3]
console.log(introductionSourceItem.entitiesInclude(1)); // true
});
onIntroductionSourceAdded
紹介元が追加された後に呼び出されるeventHookを登録します。
構文
onIntroductionSourceAdded(callback);
onIntroductionSourceAdded(callback, group);
引数
callback
紹介元が追加されたタイミングで実行する関数です。
group
指定された値でeventHookをグルーピングします。
Listenable.unlistenGroupを利用して、ここで指定したgroup
に属するeventHookを全て解除することができます。
返値
なし
例
esmJSPlugin.screen.sheetSave("businesscard").onEntered(function (screen) {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
const unlisten = IntroductionSourceItem.onIntroductionSourceAdded(
function () {
console.log("IntroductionSourceAdded");
unlisten(); // 解除
}
);
});
onIntroductionSourceRemoved
紹介元が削除された後に呼び出されるeventHookを登録します。
構文
onIntroductionSourceRemoved(callback);
onIntroductionSourceRemoved(callback, group);
引数
callback
紹介元が削除されたタイミングで実行する関数です。
group
指定された値でeventHookをグルーピングします。
Listenable.unlistenGroupを利用して、ここで指定したgroup
に属するeventHookを全て解除することができます。
返値
なし
例
esmJSPlugin.screen.sheetSave("businesscard").onEntered(function (screen) {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
const unlisten = IntroductionSourceItem.onIntroductionSourceRemoved(
function () {
console.log("IntroductionSourceRemoved");
unlisten(); // 解除
}
);
});
onIntroductionSourcesUpdated
紹介元が更新された後に呼び出されるeventHookを登録します。
構文
onIntroductionSourcesUpdated(callback);
onIntroductionSourcesUpdated(callback, group);
引数
callback
紹介元が更新されたタイミングで実行する関数です。
group
指定された値でeventHookをグルーピングします。
Listenable.unlistenGroupを利用して、ここで指定したgroup
に属するeventHookを全て解除することができます。
返値
なし
例
esmJSPlugin.screen.sheetSave("businesscard").onEntered(function (screen) {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
// entitiesが初期化されたタイミングで関数を実行
const unlisten = IntroductionSourceItem.onIntroductionSourcesUpdated(
function () {
console.log("IntroductionSourcesUpdated");
unlisten(); // 解除
}
);
});
getIntroductionSources
IntroductionSourcesクラスのインスタンスを返します。
構文
getIntroductionSources();
引数
なし
返値
IntroductionSourcesクラスのインスタンス
esmJSPlugin.sheetSave("businesscard").onSheetItemsMounted((screen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
console.log(introductionSourceItem.length);
// 3
IntroductionSourceItem.setIntroductionSourceAdded();
console.log(introductionSourceItem.length);
// 4
});
getIntroductionSourceBy
指定した ID のIntroductionSourceクラスのインスタンスを返します。
構文
getIntroductionSources(ID);
引数
ID
紹介元の ID を示す数値です。
返値
IntroductionSourceクラスのインスタンス
例
esmJSPlugin.sheetSave("businesscard").onSheetItemsMounted((screen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
const introductionSource = introductionSourceItem.getIntroductionSourceBy(1);
console.log(introductionSource.entityId);
// 1
});
getIntroductionSourceByIndex
指定した行のIntroductionSourceクラスのインスタンスを返します。
構文
getIntroductionSourceByIndex(index);
引数
index
紹介元が何行目かを示す数値です。
返値
IntroductionSourceクラスのインスタンス
例
esmJSPlugin.sheetSave("businesscard").onSheetItemsMounted((screen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
const introductionSource =
introductionSourceItem.getIntroductionSourceByIndex(1);
console.log(introductionSource.entityId);
// 1
});
setIntroductionSourceAdded
entityId
を指定して、紹介元を追加します。
構文
setIntroductionSourceAdded(entityId);
引数
entityId
紹介元の entityId を示す数値です。
返値
なし
例
esmJSPlugin.sheetSave("businesscard").onSheetItemsMounted((screen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
console.log(introductionSourceItem.length);
// 3
IntroductionSourceItem.setIntroductionSourceAdded(1);
console.log(introductionSourceItem.length);
// 4
});
setIntroductionSourceRemoved
指定した entityId
の紹介元を削除します。
構文
setIntroductionSourceAdded(entityId);
引数
entityId
紹介元の entityId を示す数値です。
返値
なし
例
esmJSPlugin.sheetSave("businesscard").onSheetItemsMounted((screen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
console.log(introductionSourceItem.length);
// 3
IntroductionSourceItem.setIntroductionSourceRemoved(1);
console.log(introductionSourceItem.length);
// 2
});
setIntroductionSourceRemovedByIndex
指定した index
の紹介元を削除します。
構文
setIntroductionSourceRemovedByIndex(index);
引数
index
何行目かの紹介元を示す数値です。
返値
なし
例
esmJSPlugin.sheetSave("businesscard").onSheetItemsMounted((screen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
console.log(introductionSourceItem.length);
// 3
IntroductionSourceItem.setIntroductionSourceRemovedByIndex(1);
console.log(introductionSourceItem.length);
// 2
});
lengthEqualsTo
lengthが指定した数値と同じかどうかを判定します。
構文
lengthEqualsTo(number);
引数
number
比較対象の数値です。
返値
真偽値
例
esmJSPlugin.sheetEntry("businesscard").onEntered((SheetSaveScreen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
introductionSourceItem.onUpdated(function () {
// 値を確認
console.log("値:", introductionSourceItem.length); // 値: 7
const result = introductionSourceItem.lengthEqualsTo(7);
console.log("紹介元数が7であるか:", result); // 紹介元数が7であるか: true
});
});
lengthIsGreaterThan
lengthが指定した数値より大きいかどうかを判定します。
構文
lengthIsGreaterThan(number);
引数
number
比較対象の数値です。
返値
真偽値
例
esmJSPlugin.sheetEntry("businesscard").onEntered((SheetSaveScreen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
introductionSourceItem.onUpdated(function () {
// 値を確認
console.log("値:", introductionSourceItem.length); // 値: 7
const result = introductionSourceItem.lengthIsGreaterThan(6);
console.log("紹介元数が6より大きいか:", result); // 紹介元数が6より大きいか: true
});
});
lengthIsGreaterThanOrEqual
lengthが指定した数値以上かどうかを判定します。
構文
lengthIsGreaterThanOrEqual(number);
引数
number
比較対象の数値です。
返値
真偽値
例
esmJSPlugin.sheetEntry("businesscard").onEntered((SheetSaveScreen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
introductionSourceItem.onUpdated(function () {
// 値を確認
console.log("値:", introductionSourceItem.length); // 値: 7
const result = introductionSourceItem.lengthIsGreaterThanOrEqual(6);
console.log("紹介元数が6以上か:", result); // 紹介元数が6以上か: true
});
});
lengthIsLessThan
lengthが指定した数値より小さいかどうかを判定します。
構文
lengthIsLessThan(number);
引数
number
比較対象の数値です。
返値
真偽値
例
esmJSPlugin.sheetEntry("businesscard").onEntered((SheetSaveScreen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
introductionSourceItem.onUpdated(function () {
// 値を確認
console.log("値:", introductionSourceItem.length); // 値: 7
const result = introductionSourceItem.lengthIsLessThan(10);
console.log("紹介元数が10未満か:", result); // 紹介元数が10未満か: true
});
});
lengthIsLessThanOrEqual
lengthが指定した数値以下かどうかを判定します。
構文
lengthIsLessThanOrEqual(number);
引数
number
比較対象の数値です。
返値
真偽値
例
esmJSPlugin.sheetEntry("businesscard").onEntered((SheetSaveScreen) => {
const introductionSourceItem = screen.getSheetItemByLabel("紹介元");
introductionSourceItem.onUpdated(function () {
// 値を確認
console.log("値:", introductionSourceItem.length); // 値: 7
const result = introductionSourceItem.lengthIsLessThanOrEqual(8);
console.log("紹介元数が8以下か:", result); // 紹介元数が8以下か: true
});
});