code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function getCurrentScope() {
return activeEffectScope;
} | This should only be called on non-detached scopes
@internal | getCurrentScope | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
function onScopeDispose(fn) {
if (activeEffectScope) {
activeEffectScope.cleanups.push(fn);
} else {
warn$2(
`onScopeDispose() is called when there is no active effect scope to be associated with.`
);
}
} | This should only be called on non-detached scopes
@internal | onScopeDispose | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
constructor(fn, trigger, scheduler, scope) {
this.fn = fn;
this.trigger = trigger;
this.scheduler = scheduler;
this.active = true;
this.deps = [];
/**
* @internal
*/
this._dirtyLevel = 3;
/**
* @internal
*/
this._trackId = 0;
/**
* @internal
*/
t... | This should only be called on non-detached scopes
@internal | constructor | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
_resolveDef() {
this._resolved = true;
for (let i = 0; i < this.attributes.length; i++) {
this._setAttr(this.attributes[i].name);
}
this._ob = new MutationObserver((mutations) => {
for (const m of mutations) {
this._setAttr(m.attributeName);
}
});
this._ob.observe(this,... | resolve inner component definition (handle possible async component) | _resolveDef | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
resolve = (def, isAsync = false) => {
const { props, styles } = def;
let numberProps;
if (props && !isArray(props)) {
for (const key in props) {
const opt = props[key];
if (opt === Number || opt && opt.type === Number) {
if (key in this._props) {
t... | resolve inner component definition (handle possible async component) | resolve | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
resolve = (def, isAsync = false) => {
const { props, styles } = def;
let numberProps;
if (props && !isArray(props)) {
for (const key in props) {
const opt = props[key];
if (opt === Number || opt && opt.type === Number) {
if (key in this._props) {
t... | resolve inner component definition (handle possible async component) | resolve | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
_resolveProps(def) {
const { props } = def;
const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
for (const key of Object.keys(this)) {
if (key[0] !== "_" && declaredPropKeys.includes(key)) {
this._setProp(key, this[key], true, false);
}
}
for (const key of... | resolve inner component definition (handle possible async component) | _resolveProps | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
get() {
return this._getProp(key);
} | resolve inner component definition (handle possible async component) | get | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
set(val) {
this._setProp(key, val);
} | resolve inner component definition (handle possible async component) | set | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
_setAttr(key) {
let value = this.getAttribute(key);
const camelKey = camelize(key);
if (this._numberProps && this._numberProps[camelKey]) {
value = toNumber(value);
}
this._setProp(camelKey, value, false);
} | resolve inner component definition (handle possible async component) | _setAttr | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
get inSFCRoot() {
return this.mode === 2 && this.stack.length === 0;
} | Record newline positions for fast line / column calculation | inSFCRoot | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
reset() {
this.state = 1;
this.mode = 0;
this.buffer = "";
this.sectionStart = 0;
this.index = 0;
this.baseState = 1;
this.inRCDATA = false;
this.currentSequence = void 0;
this.newlines.length = 0;
this.delimiterOpen = defaultDelimitersOpen;
this.delimiterClose = defaultDelim... | Record newline positions for fast line / column calculation | reset | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
getPos(index) {
let line = 1;
let column = index + 1;
for (let i = this.newlines.length - 1; i >= 0; i--) {
const newlineIndex = this.newlines[i];
if (index > newlineIndex) {
line = i + 2;
column = index - newlineIndex;
break;
}
}
return {
column,
... | Generate Position object with line / column information using recorded
newline positions. We know the index is always going to be an already
processed index, so all the newlines up to this index should have been
recorded. | getPos | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
peek() {
return this.buffer.charCodeAt(this.index + 1);
} | Generate Position object with line / column information using recorded
newline positions. We know the index is always going to be an already
processed index, so all the newlines up to this index should have been
recorded. | peek | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateText(c) {
if (c === 60) {
if (this.index > this.sectionStart) {
this.cbs.ontext(this.sectionStart, this.index);
}
this.state = 5;
this.sectionStart = this.index;
} else if (!this.inVPre && c === this.delimiterOpen[0]) {
this.state = 2;
this.delimiterIndex = 0;
... | Generate Position object with line / column information using recorded
newline positions. We know the index is always going to be an already
processed index, so all the newlines up to this index should have been
recorded. | stateText | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInterpolationOpen(c) {
if (c === this.delimiterOpen[this.delimiterIndex]) {
if (this.delimiterIndex === this.delimiterOpen.length - 1) {
const start = this.index + 1 - this.delimiterOpen.length;
if (start > this.sectionStart) {
this.cbs.ontext(this.sectionStart, start);
... | Generate Position object with line / column information using recorded
newline positions. We know the index is always going to be an already
processed index, so all the newlines up to this index should have been
recorded. | stateInterpolationOpen | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInterpolation(c) {
if (c === this.delimiterClose[0]) {
this.state = 4;
this.delimiterIndex = 0;
this.stateInterpolationClose(c);
}
} | Generate Position object with line / column information using recorded
newline positions. We know the index is always going to be an already
processed index, so all the newlines up to this index should have been
recorded. | stateInterpolation | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInterpolationClose(c) {
if (c === this.delimiterClose[this.delimiterIndex]) {
if (this.delimiterIndex === this.delimiterClose.length - 1) {
this.cbs.oninterpolation(this.sectionStart, this.index + 1);
if (this.inRCDATA) {
this.state = 32;
} else {
this.state = ... | Generate Position object with line / column information using recorded
newline positions. We know the index is always going to be an already
processed index, so all the newlines up to this index should have been
recorded. | stateInterpolationClose | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateSpecialStartSequence(c) {
const isEnd = this.sequenceIndex === this.currentSequence.length;
const isMatch = isEnd ? (
// If we are at the end of the sequence, make sure the tag name has ended
isEndOfTagSection(c)
) : (
// Otherwise, do a case-insensitive comparison
(c | 32) === ... | Generate Position object with line / column information using recorded
newline positions. We know the index is always going to be an already
processed index, so all the newlines up to this index should have been
recorded. | stateSpecialStartSequence | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInRCDATA(c) {
if (this.sequenceIndex === this.currentSequence.length) {
if (c === 62 || isWhitespace(c)) {
const endOfText = this.index - this.currentSequence.length;
if (this.sectionStart < endOfText) {
const actualIndex = this.index;
this.index = endOfText;
... | Look for an end tag. For <title> and <textarea>, also decode entities. | stateInRCDATA | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateCDATASequence(c) {
if (c === Sequences.Cdata[this.sequenceIndex]) {
if (++this.sequenceIndex === Sequences.Cdata.length) {
this.state = 28;
this.currentSequence = Sequences.CdataEnd;
this.sequenceIndex = 0;
this.sectionStart = this.index + 1;
}
} else {
thi... | Look for an end tag. For <title> and <textarea>, also decode entities. | stateCDATASequence | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
fastForwardTo(c) {
while (++this.index < this.buffer.length) {
const cc = this.buffer.charCodeAt(this.index);
if (cc === 10) {
this.newlines.push(this.index);
}
if (cc === c) {
return true;
}
}
this.index = this.buffer.length - 1;
return false;
} | When we wait for one specific character, we can speed things up
by skipping through the buffer until we find it.
@returns Whether the character was found. | fastForwardTo | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInCommentLike(c) {
if (c === this.currentSequence[this.sequenceIndex]) {
if (++this.sequenceIndex === this.currentSequence.length) {
if (this.currentSequence === Sequences.CdataEnd) {
this.cbs.oncdata(this.sectionStart, this.index - 2);
} else {
this.cbs.oncomment(this... | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInCommentLike | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
startSpecial(sequence, offset) {
this.enterRCDATA(sequence, offset);
this.state = 31;
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | startSpecial | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
enterRCDATA(sequence, offset) {
this.inRCDATA = true;
this.currentSequence = sequence;
this.sequenceIndex = offset;
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | enterRCDATA | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateBeforeTagName(c) {
if (c === 33) {
this.state = 22;
this.sectionStart = this.index + 1;
} else if (c === 63) {
this.state = 24;
this.sectionStart = this.index + 1;
} else if (isTagStartChar(c)) {
this.sectionStart = this.index;
if (this.mode === 0) {
this.sta... | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateBeforeTagName | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInTagName(c) {
if (isEndOfTagSection(c)) {
this.handleTagName(c);
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInTagName | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInSFCRootTagName(c) {
if (isEndOfTagSection(c)) {
const tag = this.buffer.slice(this.sectionStart, this.index);
if (tag !== "template") {
this.enterRCDATA(toCharCodes(`</` + tag), 0);
}
this.handleTagName(c);
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInSFCRootTagName | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
handleTagName(c) {
this.cbs.onopentagname(this.sectionStart, this.index);
this.sectionStart = -1;
this.state = 11;
this.stateBeforeAttrName(c);
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | handleTagName | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateBeforeClosingTagName(c) {
if (isWhitespace(c)) ; else if (c === 62) {
{
this.cbs.onerr(14, this.index);
}
this.state = 1;
this.sectionStart = this.index + 1;
} else {
this.state = isTagStartChar(c) ? 9 : 27;
this.sectionStart = this.index;
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateBeforeClosingTagName | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInClosingTagName(c) {
if (c === 62 || isWhitespace(c)) {
this.cbs.onclosetag(this.sectionStart, this.index);
this.sectionStart = -1;
this.state = 10;
this.stateAfterClosingTagName(c);
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInClosingTagName | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateAfterClosingTagName(c) {
if (c === 62) {
this.state = 1;
this.sectionStart = this.index + 1;
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateAfterClosingTagName | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateBeforeAttrName(c) {
if (c === 62) {
this.cbs.onopentagend(this.index);
if (this.inRCDATA) {
this.state = 32;
} else {
this.state = 1;
}
this.sectionStart = this.index + 1;
} else if (c === 47) {
this.state = 7;
if (this.peek() !== 62) {
this... | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateBeforeAttrName | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
handleAttrStart(c) {
if (c === 118 && this.peek() === 45) {
this.state = 13;
this.sectionStart = this.index;
} else if (c === 46 || c === 58 || c === 64 || c === 35) {
this.cbs.ondirname(this.index, this.index + 1);
this.state = 14;
this.sectionStart = this.index + 1;
} else {
... | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | handleAttrStart | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInSelfClosingTag(c) {
if (c === 62) {
this.cbs.onselfclosingtag(this.index);
this.state = 1;
this.sectionStart = this.index + 1;
this.inRCDATA = false;
} else if (!isWhitespace(c)) {
this.state = 11;
this.stateBeforeAttrName(c);
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInSelfClosingTag | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInAttrName(c) {
if (c === 61 || isEndOfTagSection(c)) {
this.cbs.onattribname(this.sectionStart, this.index);
this.handleAttrNameEnd(c);
} else if (c === 34 || c === 39 || c === 60) {
this.cbs.onerr(
17,
this.index
);
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInAttrName | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInDirName(c) {
if (c === 61 || isEndOfTagSection(c)) {
this.cbs.ondirname(this.sectionStart, this.index);
this.handleAttrNameEnd(c);
} else if (c === 58) {
this.cbs.ondirname(this.sectionStart, this.index);
this.state = 14;
this.sectionStart = this.index + 1;
} else if (c ... | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInDirName | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInDirArg(c) {
if (c === 61 || isEndOfTagSection(c)) {
this.cbs.ondirarg(this.sectionStart, this.index);
this.handleAttrNameEnd(c);
} else if (c === 91) {
this.state = 15;
} else if (c === 46) {
this.cbs.ondirarg(this.sectionStart, this.index);
this.state = 16;
this.s... | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInDirArg | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInDynamicDirArg(c) {
if (c === 93) {
this.state = 14;
} else if (c === 61 || isEndOfTagSection(c)) {
this.cbs.ondirarg(this.sectionStart, this.index + 1);
this.handleAttrNameEnd(c);
{
this.cbs.onerr(
27,
this.index
);
}
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInDynamicDirArg | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInDirModifier(c) {
if (c === 61 || isEndOfTagSection(c)) {
this.cbs.ondirmodifier(this.sectionStart, this.index);
this.handleAttrNameEnd(c);
} else if (c === 46) {
this.cbs.ondirmodifier(this.sectionStart, this.index);
this.sectionStart = this.index + 1;
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInDirModifier | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
handleAttrNameEnd(c) {
this.sectionStart = this.index;
this.state = 17;
this.cbs.onattribnameend(this.index);
this.stateAfterAttrName(c);
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | handleAttrNameEnd | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateAfterAttrName(c) {
if (c === 61) {
this.state = 18;
} else if (c === 47 || c === 62) {
this.cbs.onattribend(0, this.sectionStart);
this.sectionStart = -1;
this.state = 11;
this.stateBeforeAttrName(c);
} else if (!isWhitespace(c)) {
this.cbs.onattribend(0, this.sectio... | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateAfterAttrName | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateBeforeAttrValue(c) {
if (c === 34) {
this.state = 19;
this.sectionStart = this.index + 1;
} else if (c === 39) {
this.state = 20;
this.sectionStart = this.index + 1;
} else if (!isWhitespace(c)) {
this.sectionStart = this.index;
this.state = 21;
this.stateInAtt... | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateBeforeAttrValue | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
handleInAttrValue(c, quote) {
if (c === quote || this.fastForwardTo(quote)) {
this.cbs.onattribdata(this.sectionStart, this.index);
this.sectionStart = -1;
this.cbs.onattribend(
quote === 34 ? 3 : 2,
this.index + 1
);
this.state = 11;
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | handleInAttrValue | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInAttrValueDoubleQuotes(c) {
this.handleInAttrValue(c, 34);
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInAttrValueDoubleQuotes | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInAttrValueSingleQuotes(c) {
this.handleInAttrValue(c, 39);
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInAttrValueSingleQuotes | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInAttrValueNoQuotes(c) {
if (isWhitespace(c) || c === 62) {
this.cbs.onattribdata(this.sectionStart, this.index);
this.sectionStart = -1;
this.cbs.onattribend(1, this.index);
this.state = 11;
this.stateBeforeAttrName(c);
} else if (c === 34 || c === 39 || c === 60 || c === 61 ... | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInAttrValueNoQuotes | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateBeforeDeclaration(c) {
if (c === 91) {
this.state = 26;
this.sequenceIndex = 0;
} else {
this.state = c === 45 ? 25 : 23;
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateBeforeDeclaration | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInDeclaration(c) {
if (c === 62 || this.fastForwardTo(62)) {
this.state = 1;
this.sectionStart = this.index + 1;
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInDeclaration | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInProcessingInstruction(c) {
if (c === 62 || this.fastForwardTo(62)) {
this.cbs.onprocessinginstruction(this.sectionStart, this.index);
this.state = 1;
this.sectionStart = this.index + 1;
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInProcessingInstruction | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateBeforeComment(c) {
if (c === 45) {
this.state = 28;
this.currentSequence = Sequences.CommentEnd;
this.sequenceIndex = 2;
this.sectionStart = this.index + 1;
} else {
this.state = 23;
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateBeforeComment | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateInSpecialComment(c) {
if (c === 62 || this.fastForwardTo(62)) {
this.cbs.oncomment(this.sectionStart, this.index);
this.state = 1;
this.sectionStart = this.index + 1;
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateInSpecialComment | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateBeforeSpecialS(c) {
const lower = c | 32;
if (lower === Sequences.ScriptEnd[3]) {
this.startSpecial(Sequences.ScriptEnd, 4);
} else if (lower === Sequences.StyleEnd[3]) {
this.startSpecial(Sequences.StyleEnd, 4);
} else {
this.state = 6;
this.stateInTagName(c);
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateBeforeSpecialS | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
stateBeforeSpecialT(c) {
const lower = c | 32;
if (lower === Sequences.TitleEnd[3]) {
this.startSpecial(Sequences.TitleEnd, 4);
} else if (lower === Sequences.TextareaEnd[3]) {
this.startSpecial(Sequences.TextareaEnd, 4);
} else {
this.state = 6;
this.stateInTagName(c);
}
} | Comments and CDATA end with `-->` and `]]>`.
Their common qualities are:
- Their end sequences have a distinct character they start with.
- That character is then repeated, so we have to check multiple repeats.
- All characters but the start character of the sequence can be skipped. | stateBeforeSpecialT | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
parse(input) {
this.buffer = input;
while (this.index < this.buffer.length) {
const c = this.buffer.charCodeAt(this.index);
if (c === 10) {
this.newlines.push(this.index);
}
switch (this.state) {
case 1: {
this.stateText(c);
break;
}
ca... | Iterates through the buffer, calling the function corresponding to the current state.
States that are more likely to be hit are higher up, as a performance improvement. | parse | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
cleanup() {
if (this.sectionStart !== this.index) {
if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
this.cbs.ontext(this.sectionStart, this.index);
this.sectionStart = this.index;
} else if (this.state === 19 || this.state === 20 || this.state === 21) {
t... | Remove data that has already been consumed from the buffer. | cleanup | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
finish() {
this.handleTrailingData();
this.cbs.onend();
} | Remove data that has already been consumed from the buffer. | finish | javascript | icai/vue3-calendar | lib/calendar.js | https://github.com/icai/vue3-calendar/blob/master/lib/calendar.js | MIT |
function removeRipple(e, el, ripple) {
// Check if the ripple still exist
if (!ripple) {
return;
}
ripple.classList.remove('waves-rippling');
var relativeX = ripple.getAttribute('data-x');
var relativeY = ripple.getAttribute('data-y');
var scale ... | Hide the effect and remove the ripple. Must be
a separate function to pass the JSLint... | removeRipple | javascript | fians/Waves | dist/waves.js | https://github.com/fians/Waves/blob/master/dist/waves.js | MIT |
function getWavesEffectElement(e) {
if (TouchHandler.allowEvent(e) === false) {
return null;
}
var element = null;
var target = e.target || e.srcElement;
while (target.parentElement) {
if ( (!(target instanceof SVGElement)) && target.classList.contains(... | Delegated click handler for .waves-effect element.
returns null when .waves-effect element not in "click tree" | getWavesEffectElement | javascript | fians/Waves | dist/waves.js | https://github.com/fians/Waves/blob/master/dist/waves.js | MIT |
function showEffect(e) {
// Disable effect if element has "disabled" property on it
// In some cases, the event is not triggered by the current element
// if (e.target.getAttribute('disabled') !== null) {
// return;
// }
var element = getWavesEffectElement(e);
... | Bubble the click and show effect if .waves-effect elem was found | showEffect | javascript | fians/Waves | dist/waves.js | https://github.com/fians/Waves/blob/master/dist/waves.js | MIT |
hideEffect = function(hideEvent) {
// if touch hasn't moved, and effect not yet started: start effect now
if (timer) {
clearTimeout(timer);
timer = null;
Effect.show(e, element);
}
... | Bubble the click and show effect if .waves-effect elem was found | hideEffect | javascript | fians/Waves | dist/waves.js | https://github.com/fians/Waves/blob/master/dist/waves.js | MIT |
touchMove = function(moveEvent) {
if (timer) {
clearTimeout(timer);
timer = null;
}
hideEffect(moveEvent);
removeListeners();
} | Bubble the click and show effect if .waves-effect elem was found | touchMove | javascript | fians/Waves | dist/waves.js | https://github.com/fians/Waves/blob/master/dist/waves.js | MIT |
removeListeners = function() {
element.removeEventListener('touchmove', touchMove);
element.removeEventListener('touchend', hideEffect);
element.removeEventListener('touchcancel', hideEffect);
} | Bubble the click and show effect if .waves-effect elem was found | removeListeners | javascript | fians/Waves | dist/waves.js | https://github.com/fians/Waves/blob/master/dist/waves.js | MIT |
hideRipple = function(mouseup, element) {
return function() {
Effect.hide(mouseup, element);
};
} | Cause a ripple to appear in an element via code. | hideRipple | javascript | fians/Waves | dist/waves.js | https://github.com/fians/Waves/blob/master/dist/waves.js | MIT |
function removeRipple(e, el, ripple) {
// Check if the ripple still exist
if (!ripple) {
return;
}
ripple.classList.remove('waves-rippling');
var relativeX = ripple.getAttribute('data-x');
var relativeY = ripple.getAttribute('data-y');
var scale ... | Hide the effect and remove the ripple. Must be
a separate function to pass the JSLint... | removeRipple | javascript | fians/Waves | src/js/waves.js | https://github.com/fians/Waves/blob/master/src/js/waves.js | MIT |
function getWavesEffectElement(e) {
if (TouchHandler.allowEvent(e) === false) {
return null;
}
var element = null;
var target = e.target || e.srcElement;
while (target.parentElement) {
if ( (!(target instanceof SVGElement)) && target.classList.contains(... | Delegated click handler for .waves-effect element.
returns null when .waves-effect element not in "click tree" | getWavesEffectElement | javascript | fians/Waves | src/js/waves.js | https://github.com/fians/Waves/blob/master/src/js/waves.js | MIT |
function showEffect(e) {
// Disable effect if element has "disabled" property on it
// In some cases, the event is not triggered by the current element
// if (e.target.getAttribute('disabled') !== null) {
// return;
// }
var element = getWavesEffectElement(e);
... | Bubble the click and show effect if .waves-effect elem was found | showEffect | javascript | fians/Waves | src/js/waves.js | https://github.com/fians/Waves/blob/master/src/js/waves.js | MIT |
hideEffect = function(hideEvent) {
// if touch hasn't moved, and effect not yet started: start effect now
if (timer) {
clearTimeout(timer);
timer = null;
Effect.show(e, element);
}
... | Bubble the click and show effect if .waves-effect elem was found | hideEffect | javascript | fians/Waves | src/js/waves.js | https://github.com/fians/Waves/blob/master/src/js/waves.js | MIT |
touchMove = function(moveEvent) {
if (timer) {
clearTimeout(timer);
timer = null;
}
hideEffect(moveEvent);
removeListeners();
} | Bubble the click and show effect if .waves-effect elem was found | touchMove | javascript | fians/Waves | src/js/waves.js | https://github.com/fians/Waves/blob/master/src/js/waves.js | MIT |
removeListeners = function() {
element.removeEventListener('touchmove', touchMove);
element.removeEventListener('touchend', hideEffect);
element.removeEventListener('touchcancel', hideEffect);
} | Bubble the click and show effect if .waves-effect elem was found | removeListeners | javascript | fians/Waves | src/js/waves.js | https://github.com/fians/Waves/blob/master/src/js/waves.js | MIT |
hideRipple = function(mouseup, element) {
return function() {
Effect.hide(mouseup, element);
};
} | Cause a ripple to appear in an element via code. | hideRipple | javascript | fians/Waves | src/js/waves.js | https://github.com/fians/Waves/blob/master/src/js/waves.js | MIT |
constructor(code, message) {
super(`${code}: ${message}`);
this.code = code;
} | @class BaseError
@constructor
@private
@param {String} code Error code
@param {String} message Error message | constructor | javascript | yagop/node-telegram-bot-api | src/errors.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/errors.js | MIT |
toJSON() {
return {
code: this.code,
message: this.message,
};
} | @class BaseError
@constructor
@private
@param {String} code Error code
@param {String} message Error message | toJSON | javascript | yagop/node-telegram-bot-api | src/errors.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/errors.js | MIT |
constructor(data) {
const error = (typeof data === 'string') ? null : data;
const message = error ? error.message : data;
super('EFATAL', message);
if (error) {
this.stack = error.stack;
this.cause = error;
}
} | Fatal Error. Error code is `"EFATAL"`.
@class FatalError
@constructor
@param {String|Error} data Error object or message | constructor | javascript | yagop/node-telegram-bot-api | src/errors.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/errors.js | MIT |
constructor(message, response) {
super('EPARSE', message);
this.response = response;
} | Error during parsing. Error code is `"EPARSE"`.
@class ParseError
@constructor
@param {String} message Error message
@param {http.IncomingMessage} response Server response | constructor | javascript | yagop/node-telegram-bot-api | src/errors.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/errors.js | MIT |
constructor(message, response) {
super('ETELEGRAM', message);
this.response = response;
} | Error returned from Telegram. Error code is `"ETELEGRAM"`.
@class TelegramError
@constructor
@param {String} message Error message
@param {http.IncomingMessage} response Server response | constructor | javascript | yagop/node-telegram-bot-api | src/errors.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/errors.js | MIT |
function stringify(data) {
if (typeof data === 'string') {
return data;
}
return JSON.stringify(data);
} | JSON-serialize data. If the provided data is already a String,
return it as is.
@private
@param {*} data
@return {String} | stringify | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
static get errors() {
return errors;
} | The different errors the library uses.
@type {Object} | errors | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
static get messageTypes() {
return _messageTypes;
} | The types of message updates the library handles.
@type {String[]} | messageTypes | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
_buildURL(_path) {
return `${this.options.baseApiUrl}/bot${this.token}${this.options.testEnvironment ? '/test' : ''}/${_path}`;
} | Generates url with bot token and provided path/method you want to be got/executed by bot
@param {String} path
@return {String} url
@private
@see https://core.telegram.org/bots/api#making-requests | _buildURL | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
_fixReplyMarkup(obj) {
const replyMarkup = obj.reply_markup;
if (replyMarkup && typeof replyMarkup !== 'string') {
obj.reply_markup = stringify(replyMarkup);
}
} | Fix 'reply_markup' parameter by making it JSON-serialized, as
required by the Telegram Bot API
@param {Object} obj Object; either 'form' or 'qs'
@private
@see https://core.telegram.org/bots/api#sendmessage | _fixReplyMarkup | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
_fixEntitiesField(obj) {
const entities = obj.entities;
const captionEntities = obj.caption_entities;
const explanationEntities = obj.explanation_entities;
if (entities && typeof entities !== 'string') {
obj.entities = stringify(entities);
}
if (captionEntities && typeof captionEntities !... | Fix 'entities' or 'caption_entities' or 'explanation_entities' parameter by making it JSON-serialized, as
required by the Telegram Bot API
@param {Object} obj Object;
@private
@see https://core.telegram.org/bots/api#sendmessage
@see https://core.telegram.org/bots/api#copymessage
@see https://core.telegram.org/bots/api#... | _fixEntitiesField | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
_fixAddFileThumbnail(options, opts) {
if (options.thumb) {
if (opts.formData === null) {
opts.formData = {};
}
const attachName = 'photo';
const [formData] = this._formatSendData(attachName, options.thumb.replace('attach://', ''));
if (formData) {
opts.formData[attach... | Fix 'entities' or 'caption_entities' or 'explanation_entities' parameter by making it JSON-serialized, as
required by the Telegram Bot API
@param {Object} obj Object;
@private
@see https://core.telegram.org/bots/api#sendmessage
@see https://core.telegram.org/bots/api#copymessage
@see https://core.telegram.org/bots/api#... | _fixAddFileThumbnail | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
_fixReplyParameters(obj) {
if (obj.hasOwnProperty('reply_parameters') && typeof obj.reply_parameters !== 'string') {
obj.reply_parameters = stringify(obj.reply_parameters);
}
} | Fix 'reply_parameters' parameter by making it JSON-serialized, as
required by the Telegram Bot API
@param {Object} obj Object; either 'form' or 'qs'
@private
@see https://core.telegram.org/bots/api#sendmessage | _fixReplyParameters | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
_request(_path, options = {}) {
if (!this.token) {
return Promise.reject(new errors.FatalError('Telegram Bot Token not provided!'));
}
if (this.options.request) {
Object.assign(options, this.options.request);
}
if (options.form) {
this._fixReplyMarkup(options.form);
this._f... | Make request against the API
@param {String} _path API endpoint
@param {Object} [options]
@private
@return {Promise} | _request | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
_formatSendData(type, data, fileOptions = {}) {
const deprecationMessage =
'See https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files' +
' for more information on how sending files has been improved and' +
' on how to disable this deprecation message altogether.';
... | Format data to be uploaded; handles file paths, streams and buffers
@param {String} type
@param {String|stream.Stream|Buffer} data
@param {Object} fileOptions File options
@param {String} [fileOptions.filename] File name
@param {String} [fileOptions.contentType] Content type (i.e. MIME)
@return {Array} formatted
@retur... | _formatSendData | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
_formatSendMultipleData(type, files, fileOptions = {}) {
const formData = {};
const fileIds = {};
files.forEach((file, index) => {
let filedata = file.media || file.data || file[type];
let filename = file.filename || fileOptions.filename;
let contentType = file.contentType || fileOptions.... | Format multiple files to be uploaded; handles file paths, streams, and buffers
@param {String} type
@param {Array} files Array of file data objects
@param {Object} fileOptions File options
@param {String} [fileOptions.filename] File name
@param {String} [fileOptions.contentType] Content type (i.e. MIME)
@return {Object... | _formatSendMultipleData | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
startPolling(options = {}) {
if (this.hasOpenWebHook()) {
return Promise.reject(new errors.FatalError('Polling and WebHook are mutually exclusive'));
}
options.restart = typeof options.restart === 'undefined' ? true : options.restart;
if (!this._polling) {
this._polling = new TelegramBotPoll... | Start polling.
Rejects returned promise if a WebHook is being used by this instance.
@param {Object} [options]
@param {Boolean} [options.restart=true] Consecutive calls to this method causes polling to be restarted
@return {Promise} | startPolling | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
initPolling() {
deprecate('TelegramBot#initPolling() is deprecated. Use TelegramBot#startPolling() instead.');
return this.startPolling();
} | Alias of `TelegramBot#startPolling()`. This is **deprecated**.
@param {Object} [options]
@return {Promise}
@deprecated | initPolling | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
stopPolling(options) {
if (!this._polling) {
return Promise.resolve();
}
return this._polling.stop(options);
} | Stops polling after the last polling request resolves.
Multiple invocations do nothing if polling is already stopped.
Returning the promise of the last polling request is **deprecated**.
@param {Object} [options] Options
@param {Boolean} [options.cancel] Cancel current request
@param {String} [options.reason] Reason fo... | stopPolling | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
getFileLink(fileId, form = {}) {
return this.getFile(fileId, form)
.then(resp => `${this.options.baseApiUrl}/file/bot${this.token}/${resp.file_path}`);
} | Get link for file.
Use this method to get link for file for subsequent use.
Attention: link will be valid for 1 hour.
This method is a sugar extension of the (getFile)[#getfilefileid] method,
which returns just path to file on remote server (you will have to manually build full uri after that).
@param {String} fileId... | getFileLink | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
downloadFile(fileId, downloadDir, form = {}) {
let resolve;
let reject;
const promise = new Promise((a, b) => {
resolve = a;
reject = b;
});
const fileStream = this.getFileStream(fileId, form);
fileStream.on('info', (info) => {
const fileName = info.uri.slice(info.uri.lastIndex... | Downloads file in the specified folder.
This method is a sugar extension of the [getFileStream](#TelegramBot+getFileStream) method,
which returns a readable file stream.
@param {String} fileId File identifier to get info about
@param {String} downloadDir Absolute path to the folder in which file will be saved
@param... | downloadFile | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
onText(regexp, callback) {
this._textRegexpCallbacks.push({ regexp, callback });
} | Register a RegExp to test against an incomming text message.
@param {RegExp} regexpRexecuted with `exec`.
@param {Function} callback Callback will be called with 2 parameters,
the `msg` and the result of executing `regexp.exec` on message text. | onText | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
removeTextListener(regexp) {
const index = this._textRegexpCallbacks.findIndex((textListener) => {
return String(textListener.regexp) === String(regexp);
});
if (index === -1) {
return null;
}
return this._textRegexpCallbacks.splice(index, 1)[0];
} | Remove a listener registered with `onText()`.
@param {RegExp} regexp RegExp used previously in `onText()`
@return {Object} deletedListener The removed reply listener if
found. This object has `regexp` and `callback`
properties. If not found, returns `null`. | removeTextListener | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
clearTextListeners() {
this._textRegexpCallbacks = [];
} | Remove all listeners registered with `onText()`. | clearTextListeners | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
onReplyToMessage(chatId, messageId, callback) {
const id = ++this._replyListenerId;
this._replyListeners.push({
id,
chatId,
messageId,
callback
});
return id;
} | Register a reply to wait for a message response.
@param {Number|String} chatId The chat id where the message cames from.
@param {Number|String} messageId The message id to be replied.
@param {Function} callback Callback will be called with the reply
message.
@return {Number} id The ID of the inserted reply listener. | onReplyToMessage | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
removeReplyListener(replyListenerId) {
const index = this._replyListeners.findIndex((replyListener) => {
return replyListener.id === replyListenerId;
});
if (index === -1) {
return null;
}
return this._replyListeners.splice(index, 1)[0];
} | Removes a reply that has been prev. registered for a message response.
@param {Number} replyListenerId The ID of the reply listener.
@return {Object} deletedListener The removed reply listener if
found. This object has `id`, `chatId`, `messageId` and `callback`
properties. If not found, returns `null`. | removeReplyListener | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
clearReplyListeners() {
this._replyListeners = [];
} | Removes all replies that have been prev. registered for a message response.
@return {Array} deletedListeners An array of removed listeners. | clearReplyListeners | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
isPolling() {
return this._polling ? this._polling.isPolling() : false;
} | Return true if polling. Otherwise, false.
@return {Boolean} | isPolling | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
openWebHook() {
if (this.isPolling()) {
return Promise.reject(new errors.FatalError('WebHook and Polling are mutually exclusive'));
}
if (!this._webHook) {
this._webHook = new TelegramBotWebHook(this);
}
return this._webHook.open();
} | Open webhook.
Multiple invocations do nothing if webhook is already open.
Rejects returned promise if Polling is being used by this instance.
@return {Promise} | openWebHook | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.