This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assignMokuji = function(){ | |
/** | |
* 指定したテキストでH1もしくはH2要素を見つける | |
* @param {*} text | |
* @returns | |
*/ | |
var findH1OrH2ByText = function(text) { | |
var h1 = $("h1:contains(" + text + ")").first() | |
if(h1[0]){ | |
return h1[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Const = { | |
spreadSheetId: 'xxxxxxxxxxxxxxxxxx', | |
obentColumnIdx: 6, | |
sheetStartDate: new Date(2017, 0, 19), | |
sheetTopMarginRows: 4, | |
scheduleOrderTime: new Date(2017, 0, 1), | |
scheduleRemindTime: new Date(2017, 0, 1), | |
triggers: { | |
triggerDays: [ScriptApp.WeekDay.SUNDAY, | |
ScriptApp.WeekDay.MONDAY, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'pinia' { | |
export interface PiniaCustomProperties<Id, S, G, A> { | |
sync(key: string, ref: DocumentReference): Unsubscribe | |
sync(key: string, ref: CollectionReference): Unsubscribe | |
sync(key: string, ref: Query): Unsubscribe | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
store.sync = (key, ref) => { | |
// Document | |
if (ref instanceof DocumentReference) { | |
return onSnapshot(ref, (ds) => { | |
if (ds.exists()) { | |
store.$patch({ [key]: ds.data() }) | |
} | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { CollectionReference, DocumentReference, onSnapshot, Query, Unsubscribe } from "firebase/firestore"; | |
import { PiniaPluginContext } from "pinia"; | |
export const PiniaFirestoreSync = ({ store }: PiniaPluginContext) => { | |
store.sync = (key, ref) => { | |
// Document | |
if (ref instanceof DocumentReference) { | |
return onSnapshot(ref, (ds) => { | |
if (ds.exists()) { | |
store.$patch({ [key]: ds.data() }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PiniaPluginContext } from "pinia"; | |
// Plugin | |
const magicNumPlugin = ({ store }: PiniaPluginContext) => { | |
store.magicNumber = 5 | |
} | |
// Typing | |
declare module 'pinia' { | |
export interface PiniaCustomProperties { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { collection, getFirestore, query, where } from "firebase/firestore" | |
import { defineStore } from "pinia" | |
type ExampleDoc = { | |
name: string, | |
age: number | |
} | |
export type State = { | |
queryData: ExampleDoc[] | null, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.sync( | |
'queryData' // Property name of State | |
query // Query | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { collection, getFirestore } from "firebase/firestore" | |
import { defineStore } from "pinia" | |
type ExampleDoc = { | |
name: string, | |
age: number | |
} | |
export type State = { | |
collectionData: ExampleDoc[] | null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.sync( | |
'collectionData' // State property name of State | |
collectionRef // Collection Reference | |
) |
NewerOlder