Skip to content

ViewModel.share functions not working #283

@cafe4it

Description

@cafe4it

Hi, i try functions onCreated, autorun but not working

ViewModel.share({
  clock: {
    initialTime: new Date(),
    onCreated() {
      this.initialTime( new Date() );
      console.log('onCreated:' , this.initialTime())
    },
    autorun(){
      console.log('autorun:' , this.initialTime())
    }
  }
});

Template.example1.viewmodel({
  share: 'clock'
});
Template.example2.viewmodel({
  share: 'clock'
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions