@wordpress/core-data
Version:
Access to and manipulation of core WordPress entities.
8 lines (7 loc) • 1.69 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../src/awareness/base-awareness.ts"],
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { resolveSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { AwarenessState } from './awareness-state';\nimport { STORE_NAME as coreStore } from '../name';\nimport { generateCollaboratorInfo, areCollaboratorInfosEqual } from './utils';\n\nimport type { BaseState } from './types';\n\nexport abstract class BaseAwarenessState<\n\tState extends BaseState,\n> extends AwarenessState< State > {\n\tprotected onSetUp(): void {\n\t\tvoid this.setCurrentCollaboratorInfo();\n\t}\n\n\t/**\n\t * Set the current collaborator info in the local state.\n\t */\n\tprivate async setCurrentCollaboratorInfo(): Promise< void > {\n\t\tconst currentUser = await resolveSelect( coreStore ).getCurrentUser();\n\t\tconst collaboratorInfo = generateCollaboratorInfo( currentUser );\n\t\tthis.setLocalStateField( 'collaboratorInfo', collaboratorInfo );\n\t}\n}\n\nexport const baseEqualityFieldChecks = {\n\tcollaboratorInfo: areCollaboratorInfosEqual,\n};\n\nexport class BaseAwareness extends BaseAwarenessState< BaseState > {\n\tprotected equalityFieldChecks = baseEqualityFieldChecks;\n}\n"],
"mappings": ";AAGA,SAAS,qBAAqB;AAK9B,SAAS,sBAAsB;AAC/B,SAAS,cAAc,iBAAiB;AACxC,SAAS,0BAA0B,iCAAiC;AAI7D,IAAe,qBAAf,cAEG,eAAwB;AAAA,EACvB,UAAgB;AACzB,SAAK,KAAK,2BAA2B;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAc,6BAA8C;AAC3D,UAAM,cAAc,MAAM,cAAe,SAAU,EAAE,eAAe;AACpE,UAAM,mBAAmB,yBAA0B,WAAY;AAC/D,SAAK,mBAAoB,oBAAoB,gBAAiB;AAAA,EAC/D;AACD;AAEO,IAAM,0BAA0B;AAAA,EACtC,kBAAkB;AACnB;AAEO,IAAM,gBAAN,cAA4B,mBAAgC;AAAA,EACxD,sBAAsB;AACjC;",
"names": []
}