ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 最简形式 ``` (function (window) { 'use strict'; let trainOrder = function() { }; trainOrder.prototype = { }; window.trainOrder = trainOrder; })(window); ``` ## javascript封装 ``` (function(window){ 'use strict'; var jpush = function(){ this._init(); }; jpush.prototype = { _init : function () { if(typeof(api) == 'undefined'){ console.log('该插件只能在apicloud下运行'); }else{ this.ajpush = api.require('ajpush'); this.systemType = api.systemType; if(this.systemType == 'ios'){ // ios下自动初始化ajpush模块,不用再加载 this.testOne(); }else{ this.testTwo(this.ajpush); } this.testThree(this.ajpush); } }, testOne:function(){ //... }, testTwo: function(){ //... }, testThree: function() { //... } }; window.jpush = jpush; })(window); //example //<script type="text/javascript" src="jpush.js"></script> //var jpushHandle = new jpush(); // 实例化推送功能 ```