本文整理汇总了TypeScript中angular2-uuid.UUID类的典型用法代码示例。如果您正苦于以下问题:TypeScript UUID类的具体用法?TypeScript UUID怎么用?TypeScript UUID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UUID类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
.then((result: any) => {
// Load transcript by paragraph
for (let paragraphs of result.revisedData){
// Load words within each paragraph
for (let words of paragraphs.paragraph){
if (words.paragraphMarker){
revisedParagraph.push({
paragraphMarker: true
});
} else {
revisedParagraph.push({
'id': UUID.UUID(),
'start': words.start,
'end': words.end,
'word': words.word
});
}
}
this.revisedDataSet.push({
//TODO 'speaker': revisedParagraph.speaker
'id': UUID.UUID(),
'isEditing': false,
'paragraph': revisedParagraph
});
revisedParagraph = [];
}
this.transcriptName = result.name;
// Load audio into wavesurfer from transcript
this.wavesurfer.load(result.audioURL);
}, (errorCode: string) => {
示例2: processEdits
private processEdits(paragraph: any){
// Obtain all of the span elements in the transcript editor
let spans = document.getElementById('editable-section').children;
// Iterate through each span tag in the collection
let lenSpanCollection = spans.length;
for (let i = 0; i < lenSpanCollection; i++){
if (spans[i].hasAttribute('id')){
// Obtain all of the words within the current span tag
let unfilteredWords = spans[i].textContent.split(/[\x20|\xa0]/);
let filteredWords = spans[i].textContent.split(' ');
let words = filteredWords.filter(Boolean);
let lenWords = words.length;
/* Determine if words need to be concatenated
* by checking if the last unfiltered is not empty
* which would indicate the existence of a   char
*/
if (unfilteredWords[unfilteredWords.length - 1] != ''){
// Handle edge case where first letter is modified
if (lenWords > 1 && spans[i].nextSibling ){
let lastWord = words[words.length - 1];
let nextWord = spans[i].nextSibling.textContent;
if (nextWord){
spans[i].nextSibling.textContent = lastWord
+ nextWord;
words.pop();
lenWords--;
}
}
} //TODO
// Find the position to modify and insert the words
let insertionIndex = 0;
for (let revisedWord of paragraph){
if (revisedWord.id
=== spans[i].attributes.getNamedItem('id').value){
break;
}
insertionIndex++;
}
// Modify the original word if non empty
if (words[0].trim() !== ''){
paragraph[insertionIndex].word = words[0].trim();
}
// Insert any new words if they're non empty
for (let i = 1; i < lenWords; i++){
if (words[i].trim() !== ''){
insertionIndex++;
paragraph.splice(insertionIndex, 0, {
'id': UUID.UUID(),
'word': words[i].trim(),
'start': -1,
'end': -1
});
}
}
this.isTranscriptModified = true;
}
else {
}
}
}
示例3: onConfirmLink
private onConfirmLink(){
// Ensure that the form is valid
if (this.uploadLinkForm.valid){
// Obtain the link from the form
let link = this.uploadLinkForm.controls['link'].value;
let origin = 'youtube-play';
// Set the origin to vimeo if the url is a vimeo link
if (link.includes('vimeo')){
origin = 'vimeo';
}
// Or to soundcloud if it's from soundcloud
if (link.includes('soundcloud')){
origin = 'soundcloud';
}
// Populate pending uploads data list with link and origin
this.pendingUploadsDataSet.push({
'id': UUID.UUID(),
'link': link,
'origin': origin,
'isNameValid': true,
'isUploading': false
});
// Clear the video upload link forum
this.uploadLinkForm.reset();
}
}
示例4: onDrop
private onDrop(event: any){
// Cancel event and hover styling
this.onDropLeave(event);
// Fetch FileList object
let fileList = event.target.files || event.dataTransfer.files;
// Process all File objects
for (let file of fileList){
// Check if the MIME type of the file is permitted
if (this.permittedMimes.includes(file.type)){
// Populate pending uploads data list with file and origin
this.pendingUploadsDataSet.push({
'id': UUID.UUID(),
'file': file,
'origin': 'desktop',
'isNameValid': true,
'isUploading': false
});
} else {
// Display error message for non-permitted MIME type files
toastr.error(
this.commonService.getUXClientMessage('ERR_PERMITTED_FILE'),
'Uh Oh...'
);
return false;
}
}
}
示例5: add
add(desc: string) {
const todo: Todo = {
id: UUID.UUID(),
desc: desc,
completed: false
};
this.store$.dispatch(new TodoAddTodoAction(todo));
}
示例6: constructor
constructor( attrs: ITodo) {
this.id = UUID.UUID();
this.title = attrs.title;
this.dueDate = attrs.dueDate;
this.priority = attrs.priority || TodoPriority.Medium;
this.completed = attrs.completed != null ? attrs.completed : false;
this.description = attrs.description || '';
}
示例7: newCharacter
newCharacter() {
let uuid = UUID.UUID()
let c = new Character()
c.id = uuid
c.personal.name = "New Character"
this._dbService.addCharacter(c)
this.router.navigate(['/characters', c.id]);
}
示例8: addTask
addTask(taskName: string, description: string = '') {
this._tasks.push({
id: UUID.UUID(),
name: taskName,
description: description,
done: false
});
this._tasksObserver.next(this._tasks);
}
示例9: LoggerActionLogModel
this.storage.get('loginProfile').then(profile => {
// actionLog Model
let actionLog = new LoggerActionLogModel();
actionLog.agentid = profile.agentid;
actionLog.page = this.page;
actionLog.object = this.object;
actionLog.type = this.type;
actionLog.seq = UUID.UUID()
// call log
this.logger.insertActionLog(actionLog);
});
示例10: constructor
constructor(private navController: NavController,
private lobbyService: LobbyService,
private drawingService: DrawingService) {
var debug = false;
if(debug)
{
this.lobbyService.login(UUID.UUID());
return;
}
if(lobbyService.currentUser == null) {
let modal = Modal.create(LoginModalComponent);
this.navController.present(modal);
}
}