Noob question on project structure/including a logic class

Hi,

I have finally started playing with dojo 2+ today (I used Dojo 1 in the past). I am completely new to TypeScript and have only a little experience with Node.

I am looking at the tutorials and I am wondering what to do about creating just a simple logic class. The demo seems widget orientated, but if I want to create a function that is just logic (say some business calculation), I don’t think it should be a widget (or in a widget), but rather a class that my widgets can import. The class would not have any knowledge of the dom or app, it is just a calculation.

Where would I create such a class? I assume it would be a .ts file? Any advice and/or an example would be great.

Thanks in advance

After some fiddling, I found I can create a class like so:

export default class Logic { ... ...

I did this in a file src/Logic.ts

I was then able to include this in a test class tests/unit/LogicTest.ts with the following

const { describe, it } = intern.getInterface('bdd');
const { assert } = intern.getPlugin('chai');

import Logic from '../../src/Logic';

var l = new Logic();

describe(

and to include the test in the build I added tests/unit/all.ts with

import './LogicTest';

So ultimately, I just needed to understand TypeScript classes and make sure the imports were correct in my test and test configuration.