Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maintenance for ext4 branch (v0.0.6) #14

Open
wants to merge 4 commits into
base: ext4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions WebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ Ext.define('Ext.ux.WebSocket', {
constructor: function (cfg) {
var me = this;

me.messageQueue = (cfg.messageQueue || []).slice();

// Raises an error if no url is given
if (Ext.isEmpty(cfg)) {
Ext.Error.raise('URL for the websocket is required!');
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Ext.ux.WebSocket",
"version": "0.0.4",
"version": "v0.0.6",
"homepage": "https://github.com/wilk/ExtJS-WebSocket",
"authors": [
"Vincenzo (Wilk) Ferrari <[email protected]>"
Expand Down
16 changes: 11 additions & 5 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ Ext.define ('DEMO.view.OpenConnection', {
url: url ,
listeners: {
open: function (ws) {
if (Ext.get(ws.url)) Ext.get(ws.url).dom.innerHTML += '> WebSocket just open!<br/>';
var container = Ext.ComponentQuery.query('panel[title="' + url + '"] > container#messageCt')[0];
var messageBox = container.getEl().dom.getElementsByClassName("messageBox")[0];
messageBox.innerHTML += '> WebSocket just open!<br/>';
} ,
message: function (ws, data) {
Ext.get(ws.url).dom.innerHTML += '> ' + data + '<br/>';
var container = Ext.ComponentQuery.query('panel[title="' + url + '"] > container#messageCt')[0];
var messageBox = container.getEl().dom.getElementsByClassName("messageBox")[0];
messageBox.innerHTML += '> ' + data + '<br/>';
messageBox.scrollTop = messageBox.scrollHeight;
} ,
close: function (ws) {
var panel = Ext.getCmp ('panel' + ws.url);
var panel = Ext.ComponentQuery.query('panel[title="' + url + '"]')[0];

if ((panel != null) || (panel != undefined)) {
panel.destroy ();
Expand All @@ -41,7 +46,6 @@ Ext.define ('DEMO.view.OpenConnection', {
var panel = Ext.create ('Ext.panel.Panel', {
title: url ,
ws: ws ,
id: 'panel' + url ,

layout: 'anchor' ,

Expand All @@ -50,7 +54,8 @@ Ext.define ('DEMO.view.OpenConnection', {

items: [{
xtype: 'container' ,
html: 'Incoming from the server:<br/><div id="' + url + '" style="height: 60px; border: black solid 1px; padding: 5px; margin: 5px 0 5px 0; overflow: auto"></div>'
html: 'Incoming from the server:<br/><div class="messageBox" style="height: 60px; border: black solid 1px; padding: 5px; margin: 5px 0 5px 0; overflow: auto"></div>' ,
itemId: 'messageCt'
} , {
xtype: 'textarea' ,
labelAlign: 'top' ,
Expand Down Expand Up @@ -106,6 +111,7 @@ Ext.define ('DEMO.view.OpenConnection', {
xtype: 'textfield' ,
anchor: '100%' ,
fieldLabel: 'URL' ,
value: 'ws://localhost:9001' ,
labelAlign: 'top' ,
listeners: {
specialKey: function (tf, evt) {
Expand Down
4 changes: 2 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>ExtJS WebSocket</title>
<link rel="stylesheet" type="text/css" href="http://cdn.sencha.com/ext-4.2.0-gpl/resources/css/ext-all.css"/>
<script src="http://cdn.sencha.com/ext-4.2.0-gpl/ext-all.js"> </script>
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/extjs/4.2.1/resources/css/ext-all-debug.css"/>
<script src="http://cdnjs.cloudflare.com/ajax/libs/extjs/4.2.1/ext-all-debug.js"> </script>
<script src="demo.js"> </script>
</head>
</html>