-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple datasets support #46
Conversation
Refactor query and meta
src/components/line-chart-audification/line-chart-audification.component.spec.ts
Show resolved
Hide resolved
src/components/line-chart-audification/line-chart-audification.component.spec.ts
Show resolved
Hide resolved
src/components/line-chart-audification/line-chart-audification.component.ts
Outdated
Show resolved
Hide resolved
}, | ||
}; | ||
|
||
export function create(config: Config): Dataset { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to do this in this PR, but generally it's nice to have a small documentation for exported methods, services or any significant chunk of code so that someone can get the gist of it without reading through all the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It raises another design question here. Actually Config
, configMeta
, and create
are three necessary exports/properties for all dataset module/object, it is nice to have a abstract parent interface or class for all datasets to extend. However, they would be all static and immutable properties and I don't want developers to create instance of dataset if I make them as classes, so I make them modules when adding dataset support.
The bad things of this design are that it is hard to build mock datasets for testing and do the type inference on the map of dataset modules:
guide-doge/src/datasets/index.ts
Line 4 in 0b20324
export const datasets = { |
I would like to refactor it if you have any good ideas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off-topic but it would be great if TypeScript supports a module to implement an interface:
export module implements AbstractDataset;
Then all the members defined has to be implemented and exported, so people don't need to have an extra wrapper to make it type-safe.
EDIT: found similar discussions on microsoft/TypeScript#420 and microsoft/TypeScript#38511.
Branched off of #44
dataset
types and interfaces to expose general APIs to retrieve data from different sourcesPreferenceSerice
and support "select" type preference itemDataService
andPreference
to support switching between different sets of dataset preferenceWhat's next
UserWhiteNoiseDataset
nthDay
inDataCube
XYChartD3
x
andy
types for other chart components