Working settings sync

This commit is contained in:
Leoh 2021-10-11 12:40:42 +05:30
parent 9824d2ba31
commit b87676d7b0
4 changed files with 12 additions and 5 deletions

9
.gitignore vendored
View file

@ -14,4 +14,11 @@ main.js
data.json
#vscode
.vscode
.vscode
#buildfiles
settings.js
view/App.js
ReactView.js
settings.js
view.js

View file

@ -21,7 +21,7 @@ export default class ExamplePlugin extends Plugin {
this.addSettingTab(new ExampleSettingsTab(this.app, this));
this.registerView(
VIEW_TYPE_EXAMPLE,
(leaf) => (this.view = new ExampleView(leaf))
(leaf) => (this.view = new ExampleView(leaf, this))
);
this.addRibbonIcon("dice", "Activate view", () => { //activate view
this.activateView();

View file

@ -9,9 +9,10 @@ export const VIEW_TYPE_EXAMPLE = "example-view"
export class ExampleView extends ItemView {
plugin: ExamplePlugin;
constructor(leaf: WorkspaceLeaf) {
constructor(leaf: WorkspaceLeaf, plugin: ExamplePlugin) {
super(leaf)
console.log(this.plugin.settings) }
this.plugin = plugin
}
getViewType() {
return VIEW_TYPE_EXAMPLE

View file

@ -20,7 +20,6 @@ class App extends React.Component<any,any> {
.then(res => res.json())
.then(
result => {
console.log(result.data)
this.setState({
isLoaded: true,
tasks: result.data