Note Traits

Summary

Gotchas

Lifecycle

Activate

init {
    traitRegistrar.initialize
}
initialize {
    setupSavedTraitsFromFS
}

setupSavedTraitsFromFS {
    asyncLoopOneAtATime {
        setupTraitFromJSFile
    }
}

setupTraitFromJSFile {
    newNoteTrait = new UserDefinedTraitV1
    newNoteTrait.initialize
    registerTrait(newNoteTrait)
}

registerTrait {
    // map of traits
    registeredTraits.set(trait.id, trait)
    cmdRegistar.registerCommandForTrait(trait)
}
registerCommandForTrait {
    cmd = new CreateNoteWithTraitCommand(commandId, trait)
}

Lifecycle Old

Registering a trait

setupTraits {
    files := 
    files.forEach file => {
        newNoteTrait = new UserDefinedTraitV1
        _traitRegistrar.registerTrait(newNoteTrait)
    }
}
UserDefinedTraitV1

Creating a note

gatherInputs { 
    if trait.OnWillCreate?.setNameModifier
    ...
}

Reference

Past Tasks


Backlinks