私の英語はあまり良くありません。私は翻訳者を使ってこれを書いています。 StackOverFlowや他のサイトを十分に探して検索しましたが、必要な答えが見つかりません。Javascriptからポリマー機能にアクセスする
Polymer({
is: 'LaserLand-Cronometro',
properties: {
jugadores: Object,
minuto: Number,
segundo: Number,
centesima: Number,
hora:{
type: String,
value: '00:00:00'
},
task: Number
},
cronometro: function(){
this.centesima++
if(centesima>99){
this.centesima=0
this.segundo++
}else if(segundo > 59){
this.segundo=0
this.minuto++
}
let mm;
let ss;
let cc;
if(this.centesima<9){cc='0'+this.centesima}
if(this.segundo<9){ss='0'+this.centesima}
if(this.minuto<9){mm='0'+this.minuto}
this.hora=mm+':'+ss+':'+cc
},
evento: function(e){
console.log(e);
}
});
をしかし、私はSocket.ioで働いているように、私は例えば、JavaScriptのバニラを使用してそれらにアクセスする必要があります:
私は次のように私は関数を宣言していた中でのポリマーとのプロジェクトに取り組んでいます<script>
Polymer({
is: 'LaserLand-Cronometro',
properties: {
jugadores: Object,
minuto: Number,
segundo: Number,
centesima: Number,
hora:{
type: String,
value: '00:00:00'
},
task: Number
},
cronometro: function(){
this.centesima++
if(centesima>99){
this.centesima=0
this.segundo++
}else if(segundo > 59){
this.segundo=0
this.minuto++
}
let mm;
let ss;
let cc;
if(this.centesima<9){cc='0'+this.centesima}
if(this.segundo<9){ss='0'+this.centesima}
if(this.minuto<9){mm='0'+this.minuto}
this.hora=mm+':'+ss+':'+cc
},
evento: function(e){
console.log(e);
}
});
var socket = io('http://localhost:7000',{'forceNew': true});
var time;
socket.on('inicio', function(data){
time = setInterval(cronometro, 100);
});
私はすでにそれを行うためのさまざまな方法を試してみましたが、どれも歩いていないので、私はあなたの助けを必要としています。 つまり、は、JavaScriptで直接ポリマーに宣言された関数にアクセスする方法はありますか?