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

7
.gitignore vendored
View file

@ -15,3 +15,10 @@ data.json
#vscode #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.addSettingTab(new ExampleSettingsTab(this.app, this));
this.registerView( this.registerView(
VIEW_TYPE_EXAMPLE, VIEW_TYPE_EXAMPLE,
(leaf) => (this.view = new ExampleView(leaf)) (leaf) => (this.view = new ExampleView(leaf, this))
); );
this.addRibbonIcon("dice", "Activate view", () => { //activate view this.addRibbonIcon("dice", "Activate view", () => { //activate view
this.activateView(); this.activateView();

View file

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

View file

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